@lockerverse/react 0.2.131 → 0.2.133-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +158 -26
- package/dist/public-events.css +232 -88
- package/dist/public-events.d.ts.map +1 -1
- package/dist/public-events.js +1 -1
- package/dist/public-events.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
# `@lockerverse/react`
|
|
2
2
|
|
|
3
|
-
Tree-shakable React UI for Lockerverse
|
|
3
|
+
Tree-shakable React UI for Lockerverse payments, signup, auctions, and public Events. The Core SDK is installed automatically as a normal package dependency.
|
|
4
|
+
|
|
5
|
+
This README ships with the package and describes that release. For an installed
|
|
6
|
+
project, use its local README, `package.json` exports, and public `.d.ts` files.
|
|
7
|
+
Online examples can describe a newer release. Do not import private `dist`
|
|
8
|
+
modules or copy API details from a different SDK version.
|
|
9
|
+
|
|
10
|
+
## Usage guide
|
|
11
|
+
|
|
12
|
+
- [Install](#install) and [payment quick start](#use)
|
|
13
|
+
- [Configuration and environment](#configuration-and-environment)
|
|
14
|
+
- [Server rendering](#server-rendering) and [resource identity](#resource-identity)
|
|
15
|
+
- [Custom product UI](#custom-product-ui) and [live availability](#live-product-availability)
|
|
16
|
+
- [Donate launcher](#donate-launcher)
|
|
17
|
+
- [Signup](#signup)
|
|
18
|
+
- [Styling](#styling)
|
|
19
|
+
- [Payment outcomes](#payment-outcomes) and [recovery](#payment-recovery)
|
|
20
|
+
- [Auctions](#auctions) and [direct auction pages](#direct-auction-pages)
|
|
21
|
+
- [Public event listings](#public-event-listings)
|
|
22
|
+
|
|
23
|
+
For custom non-React clients, use the README shipped with `@lockerverse/sdk`.
|
|
4
24
|
|
|
5
25
|
## Install
|
|
6
26
|
|
|
@@ -35,8 +55,6 @@ export function Checkout() {
|
|
|
35
55
|
metadata={{ source: "community-site" }}
|
|
36
56
|
onPaymentComplete={(payment: LockerversePaymentCompletion) => {
|
|
37
57
|
console.info("Payment complete", payment.checkoutId);
|
|
38
|
-
console.info("Customer", payment.email);
|
|
39
|
-
console.info("Authoritative items", payment.lineItems);
|
|
40
58
|
}}
|
|
41
59
|
onPaymentUncertain={({ paymentReference, reason }) => {
|
|
42
60
|
console.info("Payment needs status recovery", paymentReference, reason);
|
|
@@ -165,6 +183,38 @@ cadence and configures Stripe Elements for a subscription:
|
|
|
165
183
|
Recurring checkout accepts one fixed Product. It does not accept quantities,
|
|
166
184
|
custom amounts, or multiple Products.
|
|
167
185
|
|
|
186
|
+
### Live product availability
|
|
187
|
+
|
|
188
|
+
Use the live `widget.catalog` for names, prices, and limits. Find the requested
|
|
189
|
+
product by its `listingId` or `slug`; do not keep a separate static price list.
|
|
190
|
+
Amounts are integer cents. Format them with `catalog.payment.currency`, not a
|
|
191
|
+
currency field on the product.
|
|
192
|
+
|
|
193
|
+
Before enabling a new purchase, check the selected product's `minimumQuantity`,
|
|
194
|
+
`maximumQuantity`, and `inventoryQuantity`; nullable limits mean no limit.
|
|
195
|
+
For custom amounts, use `getLockerverseMinimumCustomAmountCents(product)` from
|
|
196
|
+
`@lockerverse/sdk/checkout` to include the SDK minimum and the product minimum.
|
|
197
|
+
Also check:
|
|
198
|
+
|
|
199
|
+
- The matching `catalog.availability.listings` entry: `status`,
|
|
200
|
+
`maxPurchasableQuantity`, and `remainingQuantity`.
|
|
201
|
+
- Each `catalog.availability.sharedLimits` entry whose `listingIds` includes
|
|
202
|
+
the selected product's listing: `status` and `remainingQuantity`. Add the
|
|
203
|
+
quantities of all selected listings in that shared group before checking its
|
|
204
|
+
remaining quantity.
|
|
205
|
+
|
|
206
|
+
A missing listing availability entry means no listing-specific limit was
|
|
207
|
+
reported. Other product and shared limits still apply. These checks help the
|
|
208
|
+
host show an unavailable state; the authoritative quote decides whether the
|
|
209
|
+
selection can be purchased. Show loading, retry, and empty states. Keep an
|
|
210
|
+
unresolved payment available for recovery even if a new purchase is unavailable.
|
|
211
|
+
|
|
212
|
+
If an existing button already selects one product, open its checkout directly.
|
|
213
|
+
Use the donate launcher when the visitor needs a product picker. For a custom
|
|
214
|
+
dialog, use an accessible title, close button, focus handling, and mobile scroll
|
|
215
|
+
area. Keep recovery state in an owner that remains mounted when the dialog
|
|
216
|
+
closes. Closing a dialog does not complete or cancel a payment.
|
|
217
|
+
|
|
168
218
|
## Donate launcher
|
|
169
219
|
|
|
170
220
|
`LockerverseDonateLauncher` turns an existing payment widget into a native
|
|
@@ -238,8 +288,19 @@ export function Signup() {
|
|
|
238
288
|
|
|
239
289
|
Pass `googlePlacesApiKey` to enable US address suggestions when the signup asks for an address. Manual address entry always remains available.
|
|
240
290
|
|
|
241
|
-
|
|
242
|
-
|
|
291
|
+
## Configuration and environment
|
|
292
|
+
|
|
293
|
+
Production is the default. Payment, signup, auction, and Events hooks accept
|
|
294
|
+
`apiBaseUrl` and `environment` together. A custom URL requires an explicit
|
|
295
|
+
environment; `environment: "development"` also requires a URL. Include `/api`
|
|
296
|
+
in the API base URL. Do not infer the environment from the host website's URL.
|
|
297
|
+
Use the public community and resource slugs from the intended integration.
|
|
298
|
+
Signup uses `signupSlug`; payment uses `widgetSlug`.
|
|
299
|
+
|
|
300
|
+
The backend supplies the Stripe publishable key and connected account. Do not
|
|
301
|
+
hard-code either value or pass a secret key. The default Stripe loader handles
|
|
302
|
+
initialization. If a host supplies `stripeLoader={loadStripe}`, preserve all
|
|
303
|
+
loader arguments, including the connected-account options.
|
|
243
304
|
|
|
244
305
|
```tsx
|
|
245
306
|
const widget = useLockerverseWidget({
|
|
@@ -255,6 +316,25 @@ const widget = useLockerverseWidget({
|
|
|
255
316
|
/>
|
|
256
317
|
```
|
|
257
318
|
|
|
319
|
+
## Server rendering
|
|
320
|
+
|
|
321
|
+
Use the host framework's client component or client-only boundary for browser
|
|
322
|
+
payment UI. Keep browser storage access in an effect, not at module scope or
|
|
323
|
+
during server rendering. For TanStack Router, import `ClientOnly` from
|
|
324
|
+
`@tanstack/react-router` and put the component that owns checkout inside it:
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
import { ClientOnly } from "@tanstack/react-router";
|
|
328
|
+
|
|
329
|
+
<ClientOnly fallback={<p>Loading checkout...</p>}>
|
|
330
|
+
<Checkout />
|
|
331
|
+
</ClientOnly>
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
The host supplies this boundary; TanStack Router is not an SDK dependency.
|
|
335
|
+
Wait for saved recovery state to load before mounting payment. Remount the
|
|
336
|
+
recovery owner when its resource or recovery key changes.
|
|
337
|
+
|
|
258
338
|
## Styling
|
|
259
339
|
|
|
260
340
|
Auction checkout, payment, and signup use common email, phone, field-error, and checkbox controls. Payment and signup share the custom-field renderer. Phone fields use the lightweight payment/signup country list, normalization, and Valibot format validation. The shared phone control is imported directly, with no separate phone chunk or metadata library. Each flow keeps its existing field configuration and backend rules.
|
|
@@ -303,31 +383,83 @@ An authoritative `failed` result is retryable and the next submit receives a new
|
|
|
303
383
|
|
|
304
384
|
To abandon a locked attempt and intentionally start a new checkout, the host must remount `LockerversePayment` with a new React `key` after resolving the payment status through its own workflow.
|
|
305
385
|
|
|
306
|
-
|
|
386
|
+
### Payment recovery
|
|
307
387
|
|
|
308
|
-
|
|
309
|
-
|
|
388
|
+
Persist `onPaymentRecoveryChange` synchronously before navigation and pass the
|
|
389
|
+
saved value back through `resumePayment` after a refresh. Do not defer the save
|
|
390
|
+
to an effect. A recovery record has only `paymentReference: string` and
|
|
391
|
+
`connectedAccountId: string | null`; it contains no Stripe secret. Scope its
|
|
392
|
+
storage key to the environment, community, widget, and selection.
|
|
310
393
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const recovery = savedRecovery
|
|
314
|
-
? (JSON.parse(savedRecovery) as LockerversePaymentRecovery)
|
|
315
|
-
: null;
|
|
394
|
+
This hook reads storage after mount, validates the saved record, and keeps an
|
|
395
|
+
in-memory record if storage is unavailable:
|
|
316
396
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
397
|
+
```tsx
|
|
398
|
+
import { useEffect, useState } from "react";
|
|
399
|
+
import type { LockerversePaymentRecovery } from "@lockerverse/react/payment";
|
|
400
|
+
|
|
401
|
+
function usePaymentRecovery(recoveryKey: string) {
|
|
402
|
+
const [recovery, setRecovery] = useState<LockerversePaymentRecovery | null>(null);
|
|
403
|
+
const [loaded, setLoaded] = useState(false);
|
|
404
|
+
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
try {
|
|
407
|
+
const raw = sessionStorage.getItem(recoveryKey);
|
|
408
|
+
const saved: unknown = raw ? JSON.parse(raw) : null;
|
|
409
|
+
if (
|
|
410
|
+
saved !== null && typeof saved === "object" &&
|
|
411
|
+
"paymentReference" in saved && typeof saved.paymentReference === "string" &&
|
|
412
|
+
"connectedAccountId" in saved &&
|
|
413
|
+
(saved.connectedAccountId === null || typeof saved.connectedAccountId === "string")
|
|
414
|
+
) {
|
|
415
|
+
setRecovery({
|
|
416
|
+
paymentReference: saved.paymentReference,
|
|
417
|
+
connectedAccountId: saved.connectedAccountId,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
} catch {
|
|
421
|
+
// Invalid or unavailable storage must not break checkout.
|
|
325
422
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
423
|
+
setLoaded(true);
|
|
424
|
+
}, [recoveryKey]);
|
|
425
|
+
|
|
426
|
+
function saveRecovery(next: LockerversePaymentRecovery | null) {
|
|
427
|
+
setRecovery(next);
|
|
428
|
+
try {
|
|
429
|
+
if (next) sessionStorage.setItem(recoveryKey, JSON.stringify(next));
|
|
430
|
+
else sessionStorage.removeItem(recoveryKey);
|
|
431
|
+
} catch {
|
|
432
|
+
// Keep the in-memory record if storage is unavailable.
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return { loaded, recovery, saveRecovery };
|
|
437
|
+
}
|
|
329
438
|
```
|
|
330
439
|
|
|
440
|
+
Use it in the payment owner, keyed by the recovery key. Render checkout only
|
|
441
|
+
after `loaded` is true:
|
|
442
|
+
|
|
443
|
+
```tsx
|
|
444
|
+
const { loaded, recovery, saveRecovery } = usePaymentRecovery(recoveryKey);
|
|
445
|
+
|
|
446
|
+
return loaded ? (
|
|
447
|
+
<LockerversePayment
|
|
448
|
+
selection={selection}
|
|
449
|
+
resumePayment={recovery}
|
|
450
|
+
onPaymentRecoveryChange={saveRecovery}
|
|
451
|
+
widget={widget}
|
|
452
|
+
/>
|
|
453
|
+
) : <p>Loading checkout...</p>;
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
Retain the record on `onPaymentUncertain` and let the component recover the
|
|
457
|
+
same payment. Do not create a replacement charge for an unknown result.
|
|
458
|
+
`onPaymentComplete` confirms success; its `paymentRequired` distinguishes a
|
|
459
|
+
paid purchase from a no-charge order. This browser callback does not grant paid
|
|
460
|
+
access; access checks require server verification. Keep private contact and
|
|
461
|
+
payment data out of URLs, analytics, logs, and public metadata.
|
|
462
|
+
|
|
331
463
|
Malformed host selections and invalid custom tips render customer-safe validation messages and do not call the Lockerverse API. Product selection remains owned by the host application.
|
|
332
464
|
|
|
333
465
|
## Auctions
|
|
@@ -389,8 +521,8 @@ export function AuctionPage() {
|
|
|
389
521
|
}
|
|
390
522
|
```
|
|
391
523
|
|
|
392
|
-
Production is the default.
|
|
393
|
-
|
|
524
|
+
Production is the default. For development, set both `apiBaseUrl` and
|
|
525
|
+
`environment: "development"` as shown in [configuration](#configuration-and-environment). Auction data supplies the
|
|
394
526
|
publishable key and connected account for Stripe initialization. The backend
|
|
395
527
|
must include the auction `payment` configuration to use built-in checkout.
|
|
396
528
|
|
package/dist/public-events.css
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
.lockerverse-public-events {
|
|
2
|
-
--lockerverse-bg: #
|
|
2
|
+
--lockerverse-bg: #000;
|
|
3
3
|
--lockerverse-text: #f8f8f7;
|
|
4
4
|
--lockerverse-muted: #a7aaac;
|
|
5
5
|
--lockerverse-border: rgb(255 255 255 / 18%);
|
|
6
6
|
--lockerverse-accent: #83baa1;
|
|
7
7
|
--lockerverse-accent-contrast: #07130d;
|
|
8
|
+
--lockerverse-surface: #101213;
|
|
9
|
+
--lockerverse-popover: #1b1e1f;
|
|
8
10
|
--lockerverse-font-family: ui-sans-serif, system-ui, sans-serif;
|
|
9
11
|
box-sizing: border-box;
|
|
10
12
|
width: 100%;
|
|
11
|
-
padding:
|
|
13
|
+
padding: 0;
|
|
12
14
|
container-type: inline-size;
|
|
13
15
|
font: 14px / 1.5 var(--lockerverse-font-family);
|
|
14
16
|
color: var(--lockerverse-text);
|
|
15
17
|
background: transparent;
|
|
16
18
|
}
|
|
17
19
|
|
|
20
|
+
.lockerverse-public-events__layout {
|
|
21
|
+
display: grid;
|
|
22
|
+
grid-template-columns: minmax(160px, 184px) minmax(0, 1fr);
|
|
23
|
+
column-gap: 24px;
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
.lockerverse-public-events[data-lockerverse-theme="light"] {
|
|
19
27
|
--lockerverse-bg: #fff;
|
|
20
28
|
--lockerverse-text: #171919;
|
|
@@ -22,6 +30,8 @@
|
|
|
22
30
|
--lockerverse-border: rgb(23 25 25 / 18%);
|
|
23
31
|
--lockerverse-accent: #2d7052;
|
|
24
32
|
--lockerverse-accent-contrast: #fff;
|
|
33
|
+
--lockerverse-surface: #fff;
|
|
34
|
+
--lockerverse-popover: #fff;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
.lockerverse-public-events *,
|
|
@@ -32,12 +42,13 @@
|
|
|
32
42
|
|
|
33
43
|
.lockerverse-public-events h2,
|
|
34
44
|
.lockerverse-public-events h3,
|
|
35
|
-
.lockerverse-public-events
|
|
45
|
+
.lockerverse-public-events h3,
|
|
36
46
|
.lockerverse-public-events p {
|
|
37
47
|
margin: 0;
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
.lockerverse-public-events h2 {
|
|
51
|
+
grid-column: 1 / -1;
|
|
41
52
|
margin-bottom: 28px;
|
|
42
53
|
font-size: 24px;
|
|
43
54
|
font-weight: 600;
|
|
@@ -45,43 +56,65 @@
|
|
|
45
56
|
text-wrap: balance;
|
|
46
57
|
}
|
|
47
58
|
|
|
48
|
-
.lockerverse-public-events
|
|
49
|
-
margin-top: 5px;
|
|
59
|
+
.lockerverse-public-events h3 {
|
|
50
60
|
font-size: 20px;
|
|
51
61
|
font-weight: 650;
|
|
52
62
|
line-height: 1.25;
|
|
53
63
|
overflow-wrap: anywhere;
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
.lockerverse-public-
|
|
57
|
-
|
|
66
|
+
.lockerverse-public-events button {
|
|
67
|
+
min-height: 44px;
|
|
68
|
+
padding: 8px 12px;
|
|
69
|
+
margin-top: 12px;
|
|
70
|
+
font: inherit;
|
|
71
|
+
color: var(--lockerverse-text);
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
background: transparent;
|
|
74
|
+
border: 1px solid var(--lockerverse-border);
|
|
58
75
|
}
|
|
59
76
|
|
|
60
77
|
.lockerverse-public-events__tabs {
|
|
61
78
|
display: flex;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
grid-column: 1;
|
|
81
|
+
gap: 6px;
|
|
82
|
+
align-self: start;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.lockerverse-public-events__layout > section {
|
|
86
|
+
grid-column: 2;
|
|
87
|
+
min-width: 0;
|
|
65
88
|
}
|
|
66
89
|
|
|
67
90
|
.lockerverse-public-events .lockerverse-public-events__tab {
|
|
91
|
+
display: flex;
|
|
92
|
+
gap: 10px;
|
|
93
|
+
align-items: center;
|
|
68
94
|
min-height: 44px;
|
|
69
|
-
padding:
|
|
95
|
+
padding: 9px 12px;
|
|
70
96
|
margin: 0;
|
|
71
97
|
font-weight: 600;
|
|
72
98
|
color: var(--lockerverse-muted);
|
|
99
|
+
text-align: left;
|
|
73
100
|
border: 0;
|
|
74
|
-
border-
|
|
101
|
+
border-radius: 10px;
|
|
75
102
|
}
|
|
76
103
|
|
|
77
104
|
.lockerverse-public-events
|
|
78
105
|
.lockerverse-public-events__tab[aria-pressed="true"] {
|
|
79
106
|
color: var(--lockerverse-text);
|
|
80
|
-
|
|
107
|
+
background: var(--lockerverse-surface);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.lockerverse-public-events
|
|
111
|
+
.lockerverse-public-events__tab[aria-pressed="true"]
|
|
112
|
+
svg {
|
|
113
|
+
color: var(--lockerverse-accent);
|
|
81
114
|
}
|
|
82
115
|
|
|
83
116
|
.lockerverse-public-events__group + .lockerverse-public-events__group {
|
|
84
|
-
margin-top:
|
|
117
|
+
margin-top: 14px;
|
|
85
118
|
}
|
|
86
119
|
|
|
87
120
|
.lockerverse-public-events .lockerverse-public-events__group-title {
|
|
@@ -103,24 +136,28 @@
|
|
|
103
136
|
|
|
104
137
|
.lockerverse-public-events__item {
|
|
105
138
|
scroll-margin-top: 24px;
|
|
139
|
+
background: var(--lockerverse-bg);
|
|
106
140
|
border: 1px solid var(--lockerverse-border);
|
|
107
|
-
border-radius:
|
|
141
|
+
border-radius: 10px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.lockerverse-public-events__item:has(.lockerverse-public-events__share-menu) {
|
|
145
|
+
position: relative;
|
|
146
|
+
z-index: 2;
|
|
108
147
|
}
|
|
109
148
|
|
|
110
149
|
.lockerverse-public-events__row {
|
|
150
|
+
position: relative;
|
|
111
151
|
display: grid;
|
|
112
|
-
grid-template-columns:
|
|
152
|
+
grid-template-columns: 154px minmax(0, 1fr) max-content;
|
|
113
153
|
gap: 16px;
|
|
114
154
|
align-items: start;
|
|
115
155
|
padding: 14px;
|
|
116
156
|
}
|
|
117
157
|
|
|
118
|
-
.lockerverse-public-events__row--with-image {
|
|
119
|
-
grid-template-columns: 154px minmax(0, 1fr) auto;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
158
|
.lockerverse-public-events__image {
|
|
123
159
|
display: block;
|
|
160
|
+
grid-row: 1;
|
|
124
161
|
width: 100%;
|
|
125
162
|
height: 124px;
|
|
126
163
|
object-fit: cover;
|
|
@@ -130,10 +167,11 @@
|
|
|
130
167
|
.lockerverse-public-events__date {
|
|
131
168
|
display: flex;
|
|
132
169
|
flex-direction: column;
|
|
170
|
+
grid-row: 1;
|
|
133
171
|
align-items: center;
|
|
134
172
|
justify-content: center;
|
|
135
|
-
width:
|
|
136
|
-
height:
|
|
173
|
+
width: 100%;
|
|
174
|
+
height: 124px;
|
|
137
175
|
line-height: 1;
|
|
138
176
|
border: 1px solid var(--lockerverse-border);
|
|
139
177
|
border-radius: 7px;
|
|
@@ -164,37 +202,51 @@
|
|
|
164
202
|
.lockerverse-public-events__content {
|
|
165
203
|
display: flex;
|
|
166
204
|
flex-direction: column;
|
|
205
|
+
grid-column: 2;
|
|
167
206
|
align-items: flex-start;
|
|
168
207
|
min-width: 0;
|
|
169
208
|
}
|
|
170
209
|
|
|
171
|
-
.lockerverse-public-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
210
|
+
.lockerverse-public-events__heading {
|
|
211
|
+
width: 100%;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.lockerverse-public-events__heading:has(.lockerverse-public-events__live) {
|
|
215
|
+
padding-right: 24px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.lockerverse-public-events .lockerverse-public-events__schedule {
|
|
219
|
+
margin-top: 5px;
|
|
220
|
+
font-size: 14px;
|
|
221
|
+
line-height: 1.5;
|
|
222
|
+
color: var(--lockerverse-muted);
|
|
181
223
|
}
|
|
182
224
|
|
|
183
225
|
.lockerverse-public-events__live {
|
|
226
|
+
position: absolute;
|
|
227
|
+
top: 14px;
|
|
228
|
+
right: 14px;
|
|
184
229
|
padding: 2px 7px;
|
|
185
|
-
|
|
230
|
+
font-size: 12px;
|
|
231
|
+
font-weight: 700;
|
|
232
|
+
color: var(--lockerverse-accent-contrast);
|
|
233
|
+
text-transform: uppercase;
|
|
234
|
+
letter-spacing: 0.04em;
|
|
186
235
|
background: var(--lockerverse-accent);
|
|
187
236
|
border-radius: 999px;
|
|
188
237
|
}
|
|
189
238
|
|
|
190
|
-
.lockerverse-public-events .lockerverse-public-events__time,
|
|
191
239
|
.lockerverse-public-events .lockerverse-public-events__place {
|
|
192
|
-
margin-top:
|
|
240
|
+
margin-top: 6px;
|
|
241
|
+
font-size: 14px;
|
|
193
242
|
color: var(--lockerverse-muted);
|
|
194
243
|
}
|
|
195
244
|
|
|
196
245
|
.lockerverse-public-events .lockerverse-public-events__description {
|
|
197
246
|
margin-top: 10px;
|
|
247
|
+
font-size: 14px;
|
|
248
|
+
line-height: 1.5;
|
|
249
|
+
color: var(--lockerverse-text);
|
|
198
250
|
overflow-wrap: anywhere;
|
|
199
251
|
white-space: pre-line;
|
|
200
252
|
}
|
|
@@ -217,11 +269,15 @@
|
|
|
217
269
|
}
|
|
218
270
|
|
|
219
271
|
.lockerverse-public-events__actions {
|
|
272
|
+
position: relative;
|
|
220
273
|
display: flex;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
274
|
+
grid-row: 1;
|
|
275
|
+
grid-column: 3;
|
|
276
|
+
gap: 8px;
|
|
277
|
+
align-items: center;
|
|
278
|
+
align-self: end;
|
|
279
|
+
justify-content: flex-end;
|
|
280
|
+
min-width: 0;
|
|
225
281
|
}
|
|
226
282
|
|
|
227
283
|
.lockerverse-public-events .lockerverse-public-events__link {
|
|
@@ -229,8 +285,8 @@
|
|
|
229
285
|
gap: 8px;
|
|
230
286
|
align-items: center;
|
|
231
287
|
justify-content: center;
|
|
232
|
-
min-height:
|
|
233
|
-
padding:
|
|
288
|
+
min-height: 34px;
|
|
289
|
+
padding: 6px 12px;
|
|
234
290
|
margin: 0;
|
|
235
291
|
font-weight: 600;
|
|
236
292
|
color: var(--lockerverse-accent-contrast);
|
|
@@ -246,50 +302,87 @@
|
|
|
246
302
|
|
|
247
303
|
.lockerverse-public-events .lockerverse-public-events__share {
|
|
248
304
|
display: inline-flex;
|
|
249
|
-
gap: 8px;
|
|
250
305
|
align-items: center;
|
|
251
306
|
justify-content: center;
|
|
307
|
+
min-width: 44px;
|
|
252
308
|
min-height: 44px;
|
|
253
|
-
padding:
|
|
309
|
+
padding: 0;
|
|
254
310
|
margin: 0;
|
|
255
|
-
font-weight: 600;
|
|
256
311
|
color: var(--lockerverse-muted);
|
|
257
|
-
border:
|
|
258
|
-
border-radius:
|
|
312
|
+
border: 0;
|
|
313
|
+
border-radius: 6px;
|
|
259
314
|
}
|
|
260
315
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
grid-template-columns: 76px minmax(0, 1fr);
|
|
265
|
-
}
|
|
316
|
+
.lockerverse-public-events .lockerverse-public-events__share:hover {
|
|
317
|
+
color: var(--lockerverse-accent);
|
|
318
|
+
}
|
|
266
319
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
320
|
+
.lockerverse-public-events
|
|
321
|
+
.lockerverse-public-events__share[data-copied="true"] {
|
|
322
|
+
color: var(--lockerverse-accent);
|
|
323
|
+
}
|
|
270
324
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
325
|
+
.lockerverse-public-events__share-menu {
|
|
326
|
+
position: absolute;
|
|
327
|
+
top: calc(100% + 6px);
|
|
328
|
+
right: 0;
|
|
329
|
+
z-index: 3;
|
|
330
|
+
display: flex;
|
|
331
|
+
flex-wrap: wrap;
|
|
332
|
+
gap: 2px;
|
|
333
|
+
align-items: center;
|
|
334
|
+
min-inline-size: 0;
|
|
335
|
+
width: max-content;
|
|
336
|
+
max-width: min(300px, 80vw);
|
|
337
|
+
padding: 6px;
|
|
338
|
+
margin: 0;
|
|
339
|
+
background: var(--lockerverse-popover);
|
|
340
|
+
border: 1px solid var(--lockerverse-border);
|
|
341
|
+
border-radius: 8px;
|
|
342
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
|
|
343
|
+
}
|
|
274
344
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
grid-column: 2;
|
|
279
|
-
min-width: 0;
|
|
280
|
-
}
|
|
345
|
+
.lockerverse-public-events__share-menu[data-above="true"] {
|
|
346
|
+
top: auto;
|
|
347
|
+
bottom: calc(100% + 6px);
|
|
281
348
|
}
|
|
282
349
|
|
|
283
|
-
.lockerverse-public-
|
|
350
|
+
.lockerverse-public-events__visually-hidden {
|
|
351
|
+
position: absolute;
|
|
352
|
+
width: 1px;
|
|
353
|
+
height: 1px;
|
|
354
|
+
overflow: hidden;
|
|
355
|
+
white-space: nowrap;
|
|
356
|
+
clip: rect(0, 0, 0, 0);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.lockerverse-public-events .lockerverse-public-events__share-menu button,
|
|
360
|
+
.lockerverse-public-events .lockerverse-public-events__share-menu a {
|
|
361
|
+
display: inline-flex;
|
|
362
|
+
align-items: center;
|
|
363
|
+
justify-content: center;
|
|
364
|
+
width: 38px;
|
|
365
|
+
min-height: 38px;
|
|
366
|
+
padding: 0;
|
|
367
|
+
margin: 0;
|
|
368
|
+
font-size: 18px;
|
|
284
369
|
color: var(--lockerverse-text);
|
|
285
|
-
|
|
370
|
+
text-decoration: none;
|
|
371
|
+
border: 0;
|
|
372
|
+
border-radius: 6px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.lockerverse-public-events .lockerverse-public-events__share-menu button:hover,
|
|
376
|
+
.lockerverse-public-events .lockerverse-public-events__share-menu a:hover {
|
|
377
|
+
color: var(--lockerverse-accent);
|
|
378
|
+
background: var(--lockerverse-surface);
|
|
286
379
|
}
|
|
287
380
|
|
|
288
381
|
.lockerverse-public-events__copy-link {
|
|
289
382
|
display: grid;
|
|
290
383
|
gap: 5px;
|
|
291
384
|
width: 100%;
|
|
292
|
-
margin-top:
|
|
385
|
+
margin-top: 6px;
|
|
293
386
|
font-size: 12px;
|
|
294
387
|
color: var(--lockerverse-muted);
|
|
295
388
|
}
|
|
@@ -310,17 +403,6 @@
|
|
|
310
403
|
outline-offset: 4px;
|
|
311
404
|
}
|
|
312
405
|
|
|
313
|
-
.lockerverse-public-events button {
|
|
314
|
-
min-height: 44px;
|
|
315
|
-
padding: 8px 12px;
|
|
316
|
-
margin-top: 12px;
|
|
317
|
-
font: inherit;
|
|
318
|
-
color: var(--lockerverse-text);
|
|
319
|
-
cursor: pointer;
|
|
320
|
-
background: transparent;
|
|
321
|
-
border: 1px solid var(--lockerverse-border);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
406
|
.lockerverse-public-events__empty {
|
|
325
407
|
padding: 24px 0;
|
|
326
408
|
color: var(--lockerverse-muted);
|
|
@@ -332,33 +414,95 @@
|
|
|
332
414
|
border-radius: 8px;
|
|
333
415
|
}
|
|
334
416
|
|
|
335
|
-
@container (max-width:
|
|
417
|
+
@container (max-width: 760px) {
|
|
418
|
+
.lockerverse-public-events__layout {
|
|
419
|
+
grid-template-columns: minmax(0, 1fr);
|
|
420
|
+
row-gap: 16px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.lockerverse-public-events__tabs,
|
|
424
|
+
.lockerverse-public-events__layout > section {
|
|
425
|
+
grid-column: 1;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.lockerverse-public-events__tabs {
|
|
429
|
+
flex-direction: row;
|
|
430
|
+
flex-wrap: wrap;
|
|
431
|
+
gap: 4px;
|
|
432
|
+
border-bottom: 1px solid var(--lockerverse-border);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.lockerverse-public-events .lockerverse-public-events__tab {
|
|
436
|
+
padding: 8px 10px;
|
|
437
|
+
border-radius: 8px 8px 0 0;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
@container (max-width: 540px) {
|
|
336
442
|
.lockerverse-public-events__row {
|
|
337
|
-
grid-template-columns:
|
|
338
|
-
gap: 12px;
|
|
443
|
+
grid-template-columns: 96px minmax(0, 1fr);
|
|
444
|
+
gap: 8px 12px;
|
|
339
445
|
padding: 12px;
|
|
340
446
|
}
|
|
341
447
|
|
|
342
|
-
.lockerverse-public-
|
|
448
|
+
.lockerverse-public-events__image,
|
|
449
|
+
.lockerverse-public-events__date {
|
|
450
|
+
align-self: start;
|
|
451
|
+
width: 96px;
|
|
452
|
+
height: 96px;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.lockerverse-public-events h3 {
|
|
456
|
+
font-size: 18px;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.lockerverse-public-events__heading:has(.lockerverse-public-events__live) {
|
|
460
|
+
padding-right: 84px;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.lockerverse-public-events__live {
|
|
464
|
+
top: 12px;
|
|
465
|
+
right: 12px;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.lockerverse-public-events__image,
|
|
469
|
+
.lockerverse-public-events__date {
|
|
470
|
+
grid-row: 1 / span 2;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.lockerverse-public-events__actions {
|
|
474
|
+
grid-row: 2;
|
|
475
|
+
grid-column: 2;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.lockerverse-public-events .lockerverse-public-events__schedule,
|
|
479
|
+
.lockerverse-public-events .lockerverse-public-events__description {
|
|
480
|
+
font-size: 13px;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
@container (max-width: 320px) {
|
|
485
|
+
.lockerverse-public-events__row {
|
|
343
486
|
grid-template-columns: minmax(0, 1fr);
|
|
344
487
|
}
|
|
345
488
|
|
|
346
489
|
.lockerverse-public-events__image {
|
|
490
|
+
grid-row: 1;
|
|
491
|
+
width: 100%;
|
|
347
492
|
height: auto;
|
|
348
493
|
aspect-ratio: 16 / 9;
|
|
349
494
|
}
|
|
350
495
|
|
|
351
496
|
.lockerverse-public-events__date {
|
|
352
|
-
|
|
353
|
-
height: 72px;
|
|
497
|
+
grid-row: 1;
|
|
354
498
|
}
|
|
355
499
|
|
|
356
|
-
.lockerverse-public-
|
|
357
|
-
|
|
500
|
+
.lockerverse-public-events__content,
|
|
501
|
+
.lockerverse-public-events__actions {
|
|
502
|
+
grid-column: 1;
|
|
358
503
|
}
|
|
359
504
|
|
|
360
|
-
.lockerverse-public-
|
|
361
|
-
|
|
362
|
-
grid-column: 1;
|
|
505
|
+
.lockerverse-public-events__actions {
|
|
506
|
+
grid-row: 3;
|
|
363
507
|
}
|
|
364
508
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-events.d.ts","names":[],"sources":["../src/use-lockerverse-public-events.ts","../src/lockerverse-public-events.tsx"],"mappings":";;;KAUY;EACV,QAAQ;EACR,QAAQ;EACR;EACA,OAAO;EACP;;;iBAIc,2BACd,SAAS,uCACR;;;
|
|
1
|
+
{"version":3,"file":"public-events.d.ts","names":[],"sources":["../src/use-lockerverse-public-events.ts","../src/lockerverse-public-events.tsx"],"mappings":";;;KAUY;EACV,QAAQ;EACR,QAAQ;EACR;EACA,OAAO;EACP;;;iBAIc,2BACd,SAAS,uCACR;;;KCNS;EACV,QAAQ;;EAER;EACA;EACA;;EAEA;EACA,QAAQ;EACR,QAAQ;EACR;;;iBAqXc,0BACd,QACA,OACA,aACA,cACA,UACA,OACA,OACA,aACC,+CAA4B,IAAA"}
|
package/dist/public-events.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./immutable-resource-identity.js";import{t}from"./accent-contrast.js";import{Share2 as n}from"lucide-react";import{useCallback as r,useEffect as i,useId as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{createLockerversePublicEventsClient as d}from"@lockerverse/sdk/public-events";function f(e,t){return new Intl.DateTimeFormat(`en-US`,{day:`numeric`,month:`short`,timeZone:t,year:`numeric`}).format(new Date(e))}function p(e,t){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,minute:`2-digit`,timeZone:t,timeZoneName:`short`}).format(new Date(e))}function m(e){if(!e)return null;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`?t.toString():null}catch{return null}}function h(e,t){let n=m(e.link);if(n)return n;let r=new URL(window.location.href);return t?r.searchParams.set(`lockerverseEvents`,`past`):r.searchParams.delete(`lockerverseEvents`),r.searchParams.delete(`lockerverseEventOffset`),r.hash=`event-${e.id}`,r.toString()}function g(e){let n=e?.[`--lockerverse-accent`];if(!n||e?.[`--lockerverse-accent-contrast`]!==void 0)return e;let r=t(n);return r?{...e,"--lockerverse-accent-contrast":r}:e}function _({active:e,imageUrl:t,startAt:n,startDateLabel:r}){return t||e?u(`div`,{className:`lockerverse-public-events__meta`,children:[t?l(`time`,{dateTime:n,children:r}):null,e?l(`span`,{className:`lockerverse-public-events__live`,children:`Live now`}):null]}):null}function v({item:e,timeZone:t,active:r,past:i=!1}){let[a,o]=s(!1),[d,g]=s(!1),[v,y]=s(null),b=new Date(e.startAt),x=new Intl.DateTimeFormat(`en-US`,{month:`short`,timeZone:t}).format(b),S=new Intl.DateTimeFormat(`en-US`,{day:`numeric`,timeZone:t}).format(b),C=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`}).format(b),w=f(e.startAt,t),T=w===f(e.endAt,t)?p(e.endAt,t):`${f(e.endAt,t)} at ${p(e.endAt,t)}`,E=m(e.link),D=m(e.imageUrl),O=(e.description?.length??0)>130;async function k(){let t=h(e,i);if(navigator.share)try{await navigator.share({title:e.name,url:t});return}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return}try{await navigator.clipboard.writeText(t),g(!0)}catch{y(t)}}return l(`li`,{className:`lockerverse-public-events__item`,id:`event-${e.id}`,children:u(`article`,{className:[`lockerverse-public-events__row`,D?`lockerverse-public-events__row--with-image`:``].filter(Boolean).join(` `),children:[D?l(`img`,{alt:``,className:`lockerverse-public-events__image`,height:124,loading:`lazy`,src:D,width:154}):u(`time`,{className:`lockerverse-public-events__date`,dateTime:e.startAt,children:[l(`span`,{className:`lockerverse-public-events__month`,children:x}),l(`span`,{className:`lockerverse-public-events__day`,children:S}),l(`span`,{className:`lockerverse-public-events__year`,children:C})]}),u(`div`,{className:`lockerverse-public-events__content`,children:[l(_,{active:r,imageUrl:D,startAt:e.startAt,startDateLabel:w}),l(`h4`,{children:e.name}),u(`p`,{className:`lockerverse-public-events__time`,children:[l(`time`,{dateTime:e.startAt,children:p(e.startAt,t)}),l(`span`,{"aria-hidden":`true`,children:` — `}),l(`time`,{dateTime:e.endAt,children:T})]}),e.location?l(`p`,{className:`lockerverse-public-events__place`,children:e.location}):null,e.description?u(c,{children:[l(`p`,{className:[`lockerverse-public-events__description`,O&&!a?`lockerverse-public-events__description--clamped`:``].filter(Boolean).join(` `),children:e.description}),O?l(`button`,{"aria-expanded":a,className:`lockerverse-public-events__more`,onClick:()=>o(!a),type:`button`,children:a?`Show less`:`Read more`}):null]}):null,v?u(`label`,{className:`lockerverse-public-events__copy-link`,children:[`Copy event link`,l(`input`,{onFocus:e=>e.currentTarget.select(),readOnly:!0,value:v})]}):null]}),u(`div`,{className:`lockerverse-public-events__actions`,children:[E?u(`a`,{className:`lockerverse-public-events__link`,href:E,rel:`noopener noreferrer`,target:`_blank`,children:[`View event `,l(`span`,{"aria-hidden":`true`,children:`↗`})]}):null,u(`button`,{"aria-label":`Share ${e.name}`,className:`lockerverse-public-events__share`,onClick:k,type:`button`,children:[l(n,{"aria-hidden":`true`,size:16,strokeWidth:1.8}),d?`Link copied`:`Share`]})]})]})})}function y({events:e,title:t=`Events`,showHeading:n=!0,emptyMessage:o=`No events yet.`,timeZone:c=`America/New_York`,theme:d=`dark`,style:f,className:p}){let[m,h]=s(()=>Date.now()),[_,y]=s(`current`),[b,x]=s([]),[S,C]=s(0),[w,T]=s(!1),[E,D]=s(!1),[O,k]=s(!1),[A,j]=s(null),[M,N]=s(null),P=a(),F=r(async(t,n=!1)=>{k(!0),j(null);try{let r=await e.client.listPast({offset:t});x(e=>n?r.events:[...e,...r.events]),C(t+r.events.length),T(r.hasMore),D(!0)}catch(e){j(e instanceof Error?e.message:`Unable to load past events.`)}finally{k(!1)}},[e.client]);i(()=>{let e=window.setInterval(()=>h(Date.now()),6e4);return()=>window.clearInterval(e)},[]),i(()=>{let e=new URL(window.location.href);e.searchParams.get(`lockerverseEvents`)===`past`&&(y(`past`),N(e.hash.slice(1)),F(0,!0))},[F]),i(()=>{let e=window.location.hash.slice(1);if(!e.startsWith(`event-`))return;if(_===`current`){document.getElementById(e)?.scrollIntoView({block:`center`});return}if(!M||O||!E)return;let t=document.getElementById(M);t?(t.scrollIntoView({block:`center`}),N(null)):w?F(S):N(null)},[e.events,F,w,E,O,S,M,_]);function I(){y(`past`),!(E||O)&&F(0,!0)}let L=e.events||[],R=L.filter(e=>new Date(e.startAt).getTime()<=m&&new Date(e.endAt).getTime()>m),z=L.filter(e=>new Date(e.startAt).getTime()>m);return u(`section`,{"aria-busy":_===`past`?O:e.loading,"aria-label":t,className:[`lockerverse-public-events`,p].filter(Boolean).join(` `),"data-lockerverse-theme":d,style:g(f),children:[n?l(`h2`,{children:t}):null,u(`nav`,{"aria-label":`Event views`,className:`lockerverse-public-events__tabs`,children:[l(`button`,{"aria-controls":`${P}-current-panel`,"aria-pressed":_===`current`,className:`lockerverse-public-events__tab`,id:`${P}-current-tab`,onClick:()=>y(`current`),type:`button`,children:`Upcoming Events`}),l(`button`,{"aria-controls":`${P}-past-panel`,"aria-pressed":_===`past`,className:`lockerverse-public-events__tab`,id:`${P}-past-tab`,onClick:I,type:`button`,children:`Past Events`})]}),u(`section`,{"aria-labelledby":`${P}-current-tab`,hidden:_!==`current`,id:`${P}-current-panel`,children:[e.loading&&!e.events?l(`p`,{role:`status`,children:`Loading events…`}):null,e.error?u(`div`,{role:`alert`,children:[l(`p`,{children:e.error.message}),l(`button`,{onClick:e.refresh,type:`button`,children:`Try again`})]}):null,e.events&&R.length===0&&z.length===0?l(`p`,{className:`lockerverse-public-events__empty`,children:o}):null,R.length>0?l(`div`,{className:`lockerverse-public-events__group`,children:l(`ol`,{className:`lockerverse-public-events__list`,children:R.map(e=>l(v,{active:!0,item:e,timeZone:c},e.id))})}):null,z.length>0?u(`div`,{className:`lockerverse-public-events__group`,children:[l(`h3`,{className:`lockerverse-public-events__group-title`,children:`Upcoming`}),l(`ol`,{className:`lockerverse-public-events__list`,children:z.map(e=>l(v,{active:!1,item:e,timeZone:c},e.id))})]}):null]}),u(`section`,{"aria-labelledby":`${P}-past-tab`,hidden:_!==`past`,id:`${P}-past-panel`,children:[A?u(`div`,{role:`alert`,children:[l(`p`,{children:A}),l(`button`,{onClick:()=>F(E?S:0,!E),type:`button`,children:`Try again`})]}):null,O&&!E?l(`p`,{role:`status`,children:`Loading past events…`}):null,E&&b.length===0?l(`p`,{className:`lockerverse-public-events__empty`,children:`No past events yet.`}):null,b.length>0?l(`ol`,{className:`lockerverse-public-events__list`,children:b.map(e=>l(v,{active:!1,item:e,past:!0,timeZone:c},e.id))}):null,w?l(`button`,{className:`lockerverse-public-events__load-more`,disabled:O,onClick:()=>F(S),type:`button`,children:O?`Loading…`:`Load more past events`}):null]})]})}function b(t){e(`public events`,{apiBaseUrl:t.apiBaseUrl,communitySlug:t.communitySlug,environment:t.environment,slug:``});let n=o(t.onError);n.current=t.onError;let[a]=s(()=>d({...t,onError:e=>n.current?.(e)})),[c,l]=s(0),[u,f]=s({error:null,events:null,loading:!0});i(()=>{let e=!0;return a.list().then(t=>{e&&f({error:null,events:t,loading:!1})},t=>{e&&f(e=>({...e,error:t,loading:!1}))}),()=>{e=!1}},[a,c]);let p=r(()=>{f(e=>({...e,error:null,loading:!0})),l(e=>e+1)},[]);return{...u,client:a,refresh:p}}export{y as LockerversePublicEvents,b as useLockerversePublicEvents};
|
|
1
|
+
import{t as e}from"./immutable-resource-identity.js";import{t}from"./accent-contrast.js";import{CalendarDays as n,CalendarX2 as r,Check as i,Copy as a,Facebook as o,Forward as s,Mail as c}from"lucide-react";import{useCallback as l,useEffect as u,useId as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{createLockerversePublicEventsClient as _}from"@lockerverse/sdk/public-events";function v(e,t){return new Intl.DateTimeFormat(`en-US`,{day:`numeric`,month:`short`,timeZone:t,year:`numeric`}).format(new Date(e))}function y(e,t){return new Intl.DateTimeFormat(`en-US`,{hour:`numeric`,minute:`2-digit`,timeZone:t,timeZoneName:`short`}).format(new Date(e))}function b(e){if(!e)return null;try{let t=new URL(e);return t.protocol===`https:`||t.protocol===`http:`?t.toString():null}catch{return null}}function x(e,t){let n=b(e.link);if(n)return n;let r=new URL(window.location.href);return t?r.searchParams.set(`lockerverseEvents`,`past`):r.searchParams.delete(`lockerverseEvents`),r.searchParams.delete(`lockerverseEventOffset`),r.hash=`event-${e.id}`,r.toString()}function S(e){let n=e?.[`--lockerverse-accent`];if(!n||e?.[`--lockerverse-accent-contrast`]!==void 0)return e;let r=t(n);return r?{...e,"--lockerverse-accent-contrast":r}:e}function C(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t);try{return t.select(),document.execCommand(`copy`)}catch{return!1}finally{t.remove()}}function w({item:e,past:t}){let[n,r]=p(!1),[l,d]=p(null),[m,_]=p(null),[v,y]=p(!1),S=f(null),w=f(null),T=b(e.link),E=e=>e instanceof Node&&S.current?.contains(e);u(()=>{if(!m)return;let e=e=>{E(e.target)||_(null)},t=e=>{e.key===`Escape`&&(_(null),S.current?.contains(document.activeElement)&&w.current?.focus())},n=e=>{E(e.target)||_(null)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`focusin`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`focusin`,n)}},[m]),u(()=>{if(!n)return;let e=window.setTimeout(()=>r(!1),2200);return()=>window.clearTimeout(e)},[n]);async function D(){if(m)try{await navigator.clipboard.writeText(m),r(!0),_(null),w.current?.focus()}catch{C(m)?(r(!0),_(null),w.current?.focus()):d(m)}}return g(`div`,{className:`lockerverse-public-events__actions`,ref:S,children:[T?g(`a`,{className:`lockerverse-public-events__link`,href:T,rel:`noopener noreferrer`,target:`_blank`,children:[`View event `,h(`span`,{"aria-hidden":`true`,children:`↗`})]}):null,h(`button`,{"aria-expanded":m!==null,"aria-label":`Share ${e.name}`,className:`lockerverse-public-events__share`,"data-copied":n,onClick:()=>{!m&&w.current&&y(window.innerHeight-w.current.getBoundingClientRect().bottom<72),_(m?null:x(e,t)),r(!1),d(null)},ref:w,title:`Share ${e.name}`,type:`button`,children:n?h(i,{"aria-hidden":`true`,size:22,strokeWidth:2}):h(s,{"aria-hidden":`true`,size:22,strokeWidth:1.9})}),n?h(`span`,{className:`lockerverse-public-events__visually-hidden`,role:`status`,children:`Link copied`}):null,m?g(`fieldset`,{className:`lockerverse-public-events__share-menu`,"data-above":v,children:[g(`legend`,{className:`lockerverse-public-events__visually-hidden`,children:[`Share `,e.name]}),h(`button`,{"aria-label":`Copy event link`,onClick:D,title:`Copy link`,type:`button`,children:h(a,{"aria-hidden":`true`,size:18})}),h(`a`,{"aria-label":`Share by email`,href:`mailto:?subject=${encodeURIComponent(e.name)}&body=${encodeURIComponent(m)}`,title:`Email`,children:h(c,{"aria-hidden":`true`,size:18})}),h(`a`,{"aria-label":`Share on Facebook`,href:`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(m)}`,rel:`noopener noreferrer`,target:`_blank`,title:`Facebook`,children:h(o,{"aria-hidden":`true`,size:18})}),h(`a`,{"aria-label":`Share on X`,href:`https://twitter.com/intent/tweet?url=${encodeURIComponent(m)}&text=${encodeURIComponent(e.name)}`,rel:`noopener noreferrer`,target:`_blank`,title:`X`,children:h(`span`,{children:`𝕏`})}),l?g(`label`,{className:`lockerverse-public-events__copy-link`,children:[`Select and copy this event link`,h(`input`,{autoFocus:!0,onFocus:e=>e.currentTarget.select(),readOnly:!0,value:l})]}):null]}):null]})}function T({item:e,timeZone:t,active:n,past:r=!1}){let[i,a]=p(!1),o=new Date(e.startAt),s=new Intl.DateTimeFormat(`en-US`,{month:`short`,timeZone:t}).format(o),c=new Intl.DateTimeFormat(`en-US`,{day:`numeric`,timeZone:t}).format(o),l=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`}).format(o),u=v(e.startAt,t),d=u===v(e.endAt,t)?y(e.endAt,t):`${v(e.endAt,t)} at ${y(e.endAt,t)}`,f=b(e.imageUrl),_=(e.description?.length??0)>130;return h(`li`,{className:`lockerverse-public-events__item`,id:`event-${e.id}`,children:g(`article`,{className:`lockerverse-public-events__row`,children:[f?h(`img`,{alt:``,className:`lockerverse-public-events__image`,height:124,loading:`lazy`,src:f,width:154}):g(`time`,{className:`lockerverse-public-events__date`,dateTime:e.startAt,children:[h(`span`,{className:`lockerverse-public-events__month`,children:s}),h(`span`,{className:`lockerverse-public-events__day`,children:c}),h(`span`,{className:`lockerverse-public-events__year`,children:l})]}),g(`div`,{className:`lockerverse-public-events__content`,children:[g(`div`,{className:`lockerverse-public-events__heading`,children:[h(`h3`,{children:e.name}),n?h(`span`,{className:`lockerverse-public-events__live`,children:`Live now`}):null]}),g(`p`,{className:`lockerverse-public-events__schedule`,children:[f?g(m,{children:[h(`time`,{dateTime:e.startAt,children:u}),h(`span`,{"aria-hidden":`true`,children:` · `})]}):null,h(`time`,{dateTime:e.startAt,children:y(e.startAt,t)}),h(`span`,{"aria-hidden":`true`,children:` — `}),h(`time`,{dateTime:e.endAt,children:d})]}),e.location?h(`p`,{className:`lockerverse-public-events__place`,children:e.location}):null,e.description?g(m,{children:[h(`p`,{className:[`lockerverse-public-events__description`,_&&!i?`lockerverse-public-events__description--clamped`:``].filter(Boolean).join(` `),children:e.description}),_?h(`button`,{"aria-expanded":i,className:`lockerverse-public-events__more`,onClick:()=>a(!i),type:`button`,children:i?`Show less`:`Read more`}):null]}):null]}),h(w,{item:e,past:r})]})})}function E({events:e,title:t=`Events`,showHeading:i=!0,emptyMessage:a=`No events yet.`,timeZone:o=`America/New_York`,theme:s=`dark`,style:c,className:f}){let[m,_]=p(()=>Date.now()),[v,y]=p(`current`),[b,x]=p([]),[C,w]=p(0),[E,D]=p(!1),[O,k]=p(!1),[A,j]=p(!1),[M,N]=p(null),[P,F]=p(null),I=d(),L=l(async(t,n=!1)=>{j(!0),N(null);try{let r=await e.client.listPast({offset:t});x(e=>n?r.events:[...e,...r.events]),w(t+r.events.length),D(r.hasMore),k(!0)}catch(e){N(e instanceof Error?e.message:`Unable to load past events.`)}finally{j(!1)}},[e.client]);u(()=>{let e=window.setInterval(()=>_(Date.now()),6e4);return()=>window.clearInterval(e)},[]),u(()=>{let e=new URL(window.location.href);e.searchParams.get(`lockerverseEvents`)===`past`&&(y(`past`),F(e.hash.slice(1)),L(0,!0))},[L]),u(()=>{let e=window.location.hash.slice(1);if(!e.startsWith(`event-`))return;if(v===`current`){document.getElementById(e)?.scrollIntoView({block:`center`});return}if(!P||A||!O)return;let t=document.getElementById(P);t?(t.scrollIntoView({block:`center`}),F(null)):E?L(C):F(null)},[e.events,L,E,O,A,C,P,v]);function R(){y(`past`),!(O||A)&&L(0,!0)}let z=e.events||[],B=z.filter(e=>new Date(e.startAt).getTime()<=m&&new Date(e.endAt).getTime()>m),V=z.filter(e=>new Date(e.startAt).getTime()>m);return h(`section`,{"aria-busy":v===`past`?A:e.loading,"aria-label":t,className:[`lockerverse-public-events`,f].filter(Boolean).join(` `),"data-lockerverse-theme":s,style:S(c),children:g(`div`,{className:`lockerverse-public-events__layout`,children:[i?h(`h2`,{children:t}):null,g(`nav`,{"aria-label":`Event views`,className:`lockerverse-public-events__tabs`,children:[g(`button`,{"aria-controls":`${I}-current-panel`,"aria-pressed":v===`current`,className:`lockerverse-public-events__tab`,id:`${I}-current-tab`,onClick:()=>y(`current`),type:`button`,children:[h(n,{"aria-hidden":`true`,size:18}),`Upcoming Events`]}),g(`button`,{"aria-controls":`${I}-past-panel`,"aria-pressed":v===`past`,className:`lockerverse-public-events__tab`,id:`${I}-past-tab`,onClick:R,type:`button`,children:[h(r,{"aria-hidden":`true`,size:18}),`Past Events`]})]}),g(`section`,{"aria-labelledby":`${I}-current-tab`,hidden:v!==`current`,id:`${I}-current-panel`,children:[e.loading&&!e.events?h(`p`,{role:`status`,children:`Loading events…`}):null,e.error?g(`div`,{role:`alert`,children:[h(`p`,{children:e.error.message}),h(`button`,{onClick:e.refresh,type:`button`,children:`Try again`})]}):null,e.events&&B.length===0&&V.length===0?h(`p`,{className:`lockerverse-public-events__empty`,children:a}):null,B.length>0?h(`div`,{className:`lockerverse-public-events__group`,children:h(`ol`,{className:`lockerverse-public-events__list`,children:B.map(e=>h(T,{active:!0,item:e,timeZone:o},e.id))})}):null,V.length>0?h(`div`,{className:`lockerverse-public-events__group`,children:h(`ol`,{className:`lockerverse-public-events__list`,children:V.map(e=>h(T,{active:!1,item:e,timeZone:o},e.id))})}):null]}),g(`section`,{"aria-labelledby":`${I}-past-tab`,hidden:v!==`past`,id:`${I}-past-panel`,children:[M?g(`div`,{role:`alert`,children:[h(`p`,{children:M}),h(`button`,{onClick:()=>L(O?C:0,!O),type:`button`,children:`Try again`})]}):null,A&&!O?h(`p`,{role:`status`,children:`Loading past events…`}):null,O&&b.length===0?h(`p`,{className:`lockerverse-public-events__empty`,children:`No past events yet.`}):null,b.length>0?h(`ol`,{className:`lockerverse-public-events__list`,children:b.map(e=>h(T,{active:!1,item:e,past:!0,timeZone:o},e.id))}):null,E?h(`button`,{className:`lockerverse-public-events__load-more`,disabled:A,onClick:()=>L(C),type:`button`,children:A?`Loading…`:`Load more past events`}):null]})]})})}function D(t){e(`public events`,{apiBaseUrl:t.apiBaseUrl,communitySlug:t.communitySlug,environment:t.environment,slug:``});let n=f(t.onError);n.current=t.onError;let[r]=p(()=>_({...t,onError:e=>n.current?.(e)})),[i,a]=p(0),[o,s]=p({error:null,events:null,loading:!0});u(()=>{let e=!0;return r.list().then(t=>{e&&s({error:null,events:t,loading:!1})},t=>{e&&s(e=>({...e,error:t,loading:!1}))}),()=>{e=!1}},[r,i]);let c=l(()=>{s(e=>({...e,error:null,loading:!0})),a(e=>e+1)},[]);return{...o,client:r,refresh:c}}export{E as LockerversePublicEvents,D as useLockerversePublicEvents};
|
|
2
2
|
//# sourceMappingURL=public-events.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-events.js","names":[],"sources":["../src/lockerverse-public-events.tsx","../src/use-lockerverse-public-events.ts"],"sourcesContent":["import type { LockerversePublicEvent } from \"@lockerverse/sdk/public-events\";\nimport { Share2 } from \"lucide-react\";\nimport { useCallback, useEffect, useId, useState } from \"react\";\nimport { getAccentContrast } from \"./accent-contrast.ts\";\nimport type { LockerverseStyle, LockerverseTheme } from \"./theme.ts\";\nimport type { UseLockerversePublicEventsResult } from \"./use-lockerverse-public-events.ts\";\n\nexport type LockerversePublicEventsProps = {\n events: UseLockerversePublicEventsResult;\n /** The visible heading. Defaults to Events. */\n title?: string;\n showHeading?: boolean;\n emptyMessage?: string;\n /** Used to show dates and times. Defaults to America/New_York. */\n timeZone?: string;\n theme?: LockerverseTheme;\n style?: LockerverseStyle;\n className?: string;\n};\n\nfunction formatDate(value: string, timeZone: string) {\n return new Intl.DateTimeFormat(\"en-US\", {\n day: \"numeric\",\n month: \"short\",\n timeZone,\n year: \"numeric\",\n }).format(new Date(value));\n}\n\nfunction formatTime(value: string, timeZone: string) {\n return new Intl.DateTimeFormat(\"en-US\", {\n hour: \"numeric\",\n minute: \"2-digit\",\n timeZone,\n timeZoneName: \"short\",\n }).format(new Date(value));\n}\n\nfunction getLink(value: string | null) {\n if (!value) {\n return null;\n }\n try {\n const url = new URL(value);\n return url.protocol === \"https:\" || url.protocol === \"http:\"\n ? url.toString()\n : null;\n } catch {\n return null;\n }\n}\n\nfunction getShareUrl(item: LockerversePublicEvent, past: boolean) {\n const link = getLink(item.link);\n if (link) {\n return link;\n }\n const url = new URL(window.location.href);\n if (past) {\n url.searchParams.set(\"lockerverseEvents\", \"past\");\n } else {\n url.searchParams.delete(\"lockerverseEvents\");\n }\n url.searchParams.delete(\"lockerverseEventOffset\");\n url.hash = `event-${item.id}`;\n return url.toString();\n}\n\nfunction withAccentContrast(style?: LockerverseStyle) {\n const accent = style?.[\"--lockerverse-accent\"];\n if (!accent || style?.[\"--lockerverse-accent-contrast\"] !== undefined) {\n return style;\n }\n const contrast = getAccentContrast(accent);\n return contrast\n ? { ...style, \"--lockerverse-accent-contrast\": contrast }\n : style;\n}\n\nfunction EventDateMeta({\n active,\n imageUrl,\n startAt,\n startDateLabel,\n}: {\n active: boolean;\n imageUrl: string | null;\n startAt: string;\n startDateLabel: string;\n}) {\n if (!(imageUrl || active)) {\n return null;\n }\n\n return (\n <div className=\"lockerverse-public-events__meta\">\n {imageUrl ? <time dateTime={startAt}>{startDateLabel}</time> : null}\n {active ? (\n <span className=\"lockerverse-public-events__live\">Live now</span>\n ) : null}\n </div>\n );\n}\n\nfunction PublicEventRow({\n item,\n timeZone,\n active,\n past = false,\n}: {\n item: LockerversePublicEvent;\n timeZone: string;\n active: boolean;\n past?: boolean;\n}) {\n const [expanded, setExpanded] = useState(false);\n const [copied, setCopied] = useState(false);\n const [manualShareUrl, setManualShareUrl] = useState<string | null>(null);\n const start = new Date(item.startAt);\n const month = new Intl.DateTimeFormat(\"en-US\", {\n month: \"short\",\n timeZone,\n }).format(start);\n const day = new Intl.DateTimeFormat(\"en-US\", {\n day: \"numeric\",\n timeZone,\n }).format(start);\n const year = new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n year: \"numeric\",\n }).format(start);\n const startDateLabel = formatDate(item.startAt, timeZone);\n const sameDay = startDateLabel === formatDate(item.endAt, timeZone);\n const endLabel = sameDay\n ? formatTime(item.endAt, timeZone)\n : `${formatDate(item.endAt, timeZone)} at ${formatTime(item.endAt, timeZone)}`;\n const link = getLink(item.link);\n const imageUrl = getLink(item.imageUrl);\n const canExpand = (item.description?.length ?? 0) > 130;\n\n async function shareEvent() {\n const url = getShareUrl(item, past);\n if (navigator.share) {\n try {\n await navigator.share({ title: item.name, url });\n return;\n } catch (error) {\n if (error instanceof DOMException && error.name === \"AbortError\") {\n return;\n }\n }\n }\n try {\n await navigator.clipboard.writeText(url);\n setCopied(true);\n } catch {\n setManualShareUrl(url);\n }\n }\n\n return (\n <li className=\"lockerverse-public-events__item\" id={`event-${item.id}`}>\n <article\n className={[\n \"lockerverse-public-events__row\",\n imageUrl ? \"lockerverse-public-events__row--with-image\" : \"\",\n ]\n .filter(Boolean)\n .join(\" \")}\n >\n {imageUrl ? (\n <img\n alt=\"\"\n className=\"lockerverse-public-events__image\"\n height={124}\n loading=\"lazy\"\n src={imageUrl}\n width={154}\n />\n ) : (\n <time\n className=\"lockerverse-public-events__date\"\n dateTime={item.startAt}\n >\n <span className=\"lockerverse-public-events__month\">{month}</span>\n <span className=\"lockerverse-public-events__day\">{day}</span>\n <span className=\"lockerverse-public-events__year\">{year}</span>\n </time>\n )}\n <div className=\"lockerverse-public-events__content\">\n <EventDateMeta\n active={active}\n imageUrl={imageUrl}\n startAt={item.startAt}\n startDateLabel={startDateLabel}\n />\n <h4>{item.name}</h4>\n <p className=\"lockerverse-public-events__time\">\n <time dateTime={item.startAt}>\n {formatTime(item.startAt, timeZone)}\n </time>\n <span aria-hidden=\"true\"> — </span>\n <time dateTime={item.endAt}>{endLabel}</time>\n </p>\n {item.location ? (\n <p className=\"lockerverse-public-events__place\">{item.location}</p>\n ) : null}\n {item.description ? (\n <>\n <p\n className={[\n \"lockerverse-public-events__description\",\n canExpand && !expanded\n ? \"lockerverse-public-events__description--clamped\"\n : \"\",\n ]\n .filter(Boolean)\n .join(\" \")}\n >\n {item.description}\n </p>\n {canExpand ? (\n <button\n aria-expanded={expanded}\n className=\"lockerverse-public-events__more\"\n onClick={() => setExpanded(!expanded)}\n type=\"button\"\n >\n {expanded ? \"Show less\" : \"Read more\"}\n </button>\n ) : null}\n </>\n ) : null}\n {manualShareUrl ? (\n <label className=\"lockerverse-public-events__copy-link\">\n Copy event link\n <input\n onFocus={(event) => event.currentTarget.select()}\n readOnly\n value={manualShareUrl}\n />\n </label>\n ) : null}\n </div>\n <div className=\"lockerverse-public-events__actions\">\n {link ? (\n <a\n className=\"lockerverse-public-events__link\"\n href={link}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n View event <span aria-hidden=\"true\">↗</span>\n </a>\n ) : null}\n <button\n aria-label={`Share ${item.name}`}\n className=\"lockerverse-public-events__share\"\n onClick={shareEvent}\n type=\"button\"\n >\n <Share2 aria-hidden=\"true\" size={16} strokeWidth={1.8} />\n {copied ? \"Link copied\" : \"Share\"}\n </button>\n </div>\n </article>\n </li>\n );\n}\n\n/** Optional public list that can be embedded in any React site. */\nexport function LockerversePublicEvents({\n events,\n title = \"Events\",\n showHeading = true,\n emptyMessage = \"No events yet.\",\n timeZone = \"America/New_York\",\n theme = \"dark\",\n style,\n className,\n}: LockerversePublicEventsProps) {\n const [now, setNow] = useState(() => Date.now());\n const [view, setView] = useState<\"current\" | \"past\">(\"current\");\n const [pastEvents, setPastEvents] = useState<LockerversePublicEvent[]>([]);\n const [pastOffset, setPastOffset] = useState(0);\n const [pastHasMore, setPastHasMore] = useState(false);\n const [pastLoaded, setPastLoaded] = useState(false);\n const [pastLoading, setPastLoading] = useState(false);\n const [pastError, setPastError] = useState<string | null>(null);\n const [pastTarget, setPastTarget] = useState<string | null>(null);\n const tabId = useId();\n\n const loadPast = useCallback(\n async (offset: number, reset = false) => {\n setPastLoading(true);\n setPastError(null);\n try {\n const page = await events.client.listPast({ offset });\n setPastEvents((current) =>\n reset ? page.events : [...current, ...page.events]\n );\n setPastOffset(offset + page.events.length);\n setPastHasMore(page.hasMore);\n setPastLoaded(true);\n } catch (error) {\n setPastError(\n error instanceof Error ? error.message : \"Unable to load past events.\"\n );\n } finally {\n setPastLoading(false);\n }\n },\n [events.client]\n );\n\n useEffect(() => {\n const interval = window.setInterval(() => setNow(Date.now()), 60_000);\n return () => window.clearInterval(interval);\n }, []);\n\n useEffect(() => {\n const url = new URL(window.location.href);\n if (url.searchParams.get(\"lockerverseEvents\") !== \"past\") {\n return;\n }\n setView(\"past\");\n setPastTarget(url.hash.slice(1));\n loadPast(0, true);\n }, [loadPast]);\n\n useEffect(() => {\n const hash = window.location.hash.slice(1);\n if (!hash.startsWith(\"event-\")) {\n return;\n }\n if (view === \"current\") {\n document.getElementById(hash)?.scrollIntoView({ block: \"center\" });\n return;\n }\n if (!pastTarget || pastLoading || !pastLoaded) {\n return;\n }\n const target = document.getElementById(pastTarget);\n if (target) {\n target.scrollIntoView({ block: \"center\" });\n setPastTarget(null);\n } else if (pastHasMore) {\n loadPast(pastOffset);\n } else {\n setPastTarget(null);\n }\n }, [\n events.events,\n loadPast,\n pastHasMore,\n pastLoaded,\n pastLoading,\n pastOffset,\n pastTarget,\n view,\n ]);\n\n function openPast() {\n setView(\"past\");\n if (pastLoaded || pastLoading) {\n return;\n }\n loadPast(0, true);\n }\n\n const availableEvents = events.events || [];\n const activeEvents = availableEvents.filter(\n (item) =>\n new Date(item.startAt).getTime() <= now &&\n new Date(item.endAt).getTime() > now\n );\n const upcomingEvents = availableEvents.filter(\n (item) => new Date(item.startAt).getTime() > now\n );\n\n return (\n <section\n aria-busy={view === \"past\" ? pastLoading : events.loading}\n aria-label={title}\n className={[\"lockerverse-public-events\", className]\n .filter(Boolean)\n .join(\" \")}\n data-lockerverse-theme={theme}\n style={withAccentContrast(style)}\n >\n {showHeading ? <h2>{title}</h2> : null}\n <nav aria-label=\"Event views\" className=\"lockerverse-public-events__tabs\">\n <button\n aria-controls={`${tabId}-current-panel`}\n aria-pressed={view === \"current\"}\n className=\"lockerverse-public-events__tab\"\n id={`${tabId}-current-tab`}\n onClick={() => setView(\"current\")}\n type=\"button\"\n >\n Upcoming Events\n </button>\n <button\n aria-controls={`${tabId}-past-panel`}\n aria-pressed={view === \"past\"}\n className=\"lockerverse-public-events__tab\"\n id={`${tabId}-past-tab`}\n onClick={openPast}\n type=\"button\"\n >\n Past Events\n </button>\n </nav>\n <section\n aria-labelledby={`${tabId}-current-tab`}\n hidden={view !== \"current\"}\n id={`${tabId}-current-panel`}\n >\n {events.loading && !events.events ? (\n <p role=\"status\">Loading events…</p>\n ) : null}\n {events.error ? (\n <div role=\"alert\">\n <p>{events.error.message}</p>\n <button onClick={events.refresh} type=\"button\">\n Try again\n </button>\n </div>\n ) : null}\n {events.events &&\n activeEvents.length === 0 &&\n upcomingEvents.length === 0 ? (\n <p className=\"lockerverse-public-events__empty\">{emptyMessage}</p>\n ) : null}\n {activeEvents.length > 0 ? (\n <div className=\"lockerverse-public-events__group\">\n <ol className=\"lockerverse-public-events__list\">\n {activeEvents.map((item) => (\n <PublicEventRow\n active\n item={item}\n key={item.id}\n timeZone={timeZone}\n />\n ))}\n </ol>\n </div>\n ) : null}\n {upcomingEvents.length > 0 ? (\n <div className=\"lockerverse-public-events__group\">\n <h3 className=\"lockerverse-public-events__group-title\">Upcoming</h3>\n <ol className=\"lockerverse-public-events__list\">\n {upcomingEvents.map((item) => (\n <PublicEventRow\n active={false}\n item={item}\n key={item.id}\n timeZone={timeZone}\n />\n ))}\n </ol>\n </div>\n ) : null}\n </section>\n <section\n aria-labelledby={`${tabId}-past-tab`}\n hidden={view !== \"past\"}\n id={`${tabId}-past-panel`}\n >\n {pastError ? (\n <div role=\"alert\">\n <p>{pastError}</p>\n <button\n onClick={() => loadPast(pastLoaded ? pastOffset : 0, !pastLoaded)}\n type=\"button\"\n >\n Try again\n </button>\n </div>\n ) : null}\n {pastLoading && !pastLoaded ? (\n <p role=\"status\">Loading past events…</p>\n ) : null}\n {pastLoaded && pastEvents.length === 0 ? (\n <p className=\"lockerverse-public-events__empty\">\n No past events yet.\n </p>\n ) : null}\n {pastEvents.length > 0 ? (\n <ol className=\"lockerverse-public-events__list\">\n {pastEvents.map((item) => (\n <PublicEventRow\n active={false}\n item={item}\n key={item.id}\n past\n timeZone={timeZone}\n />\n ))}\n </ol>\n ) : null}\n {pastHasMore ? (\n <button\n className=\"lockerverse-public-events__load-more\"\n disabled={pastLoading}\n onClick={() => loadPast(pastOffset)}\n type=\"button\"\n >\n {pastLoading ? \"Loading…\" : \"Load more past events\"}\n </button>\n ) : null}\n </section>\n </section>\n );\n}\n","import {\n type CreateLockerversePublicEventsOptions,\n createLockerversePublicEventsClient,\n type LockerversePublicEvent,\n type LockerversePublicEventsClient,\n type LockerverseSdkError,\n} from \"@lockerverse/sdk/public-events\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useImmutableResourceIdentity } from \"./immutable-resource-identity.ts\";\n\nexport type UseLockerversePublicEventsResult = {\n client: LockerversePublicEventsClient;\n events: LockerversePublicEvent[] | null;\n loading: boolean;\n error: LockerverseSdkError | null;\n refresh: () => void;\n};\n\n/** Load the public events list for one community. */\nexport function useLockerversePublicEvents(\n options: CreateLockerversePublicEventsOptions\n): UseLockerversePublicEventsResult {\n useImmutableResourceIdentity(\"public events\", {\n apiBaseUrl: options.apiBaseUrl,\n communitySlug: options.communitySlug,\n environment: options.environment,\n slug: \"\",\n });\n const onErrorRef = useRef(options.onError);\n onErrorRef.current = options.onError;\n const [client] = useState(() =>\n createLockerversePublicEventsClient({\n ...options,\n onError: (error) => onErrorRef.current?.(error),\n })\n );\n const [revision, setRevision] = useState(0);\n const [state, setState] = useState<\n Pick<UseLockerversePublicEventsResult, \"events\" | \"loading\" | \"error\">\n >({ error: null, events: null, loading: true });\n\n useEffect(() => {\n let active = true;\n client.list().then(\n (events) => {\n if (active) {\n setState({ error: null, events, loading: false });\n }\n },\n (error: LockerverseSdkError) => {\n if (active) {\n setState((current) => ({ ...current, error, loading: false }));\n }\n }\n );\n return () => {\n active = false;\n };\n }, [client, revision]);\n\n const refresh = useCallback(() => {\n setState((current) => ({ ...current, error: null, loading: true }));\n setRevision((current) => current + 1);\n }, []);\n\n return { ...state, client, refresh };\n}\n"],"mappings":"4WAoBA,SAAS,EAAW,EAAe,EAAkB,CACnD,OAAO,IAAI,KAAK,eAAe,QAAS,CACtC,IAAK,UACL,MAAO,QACP,WACA,KAAM,SACR,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,CAAK,CAAC,CAC3B,CAEA,SAAS,EAAW,EAAe,EAAkB,CACnD,OAAO,IAAI,KAAK,eAAe,QAAS,CACtC,KAAM,UACN,OAAQ,UACR,WACA,aAAc,OAChB,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,CAAK,CAAC,CAC3B,CAEA,SAAS,EAAQ,EAAsB,CACrC,GAAI,CAAC,EACH,OAAO,KAET,GAAI,CACF,IAAM,EAAM,IAAI,IAAI,CAAK,EACzB,OAAO,EAAI,WAAa,UAAY,EAAI,WAAa,QACjD,EAAI,SAAS,EACb,IACN,MAAQ,CACN,OAAO,IACT,CACF,CAEA,SAAS,EAAY,EAA8B,EAAe,CAChE,IAAM,EAAO,EAAQ,EAAK,IAAI,EAC9B,GAAI,EACF,OAAO,EAET,IAAM,EAAM,IAAI,IAAI,OAAO,SAAS,IAAI,EAQxC,OAPI,EACF,EAAI,aAAa,IAAI,oBAAqB,MAAM,EAEhD,EAAI,aAAa,OAAO,mBAAmB,EAE7C,EAAI,aAAa,OAAO,wBAAwB,EAChD,EAAI,KAAO,SAAS,EAAK,KAClB,EAAI,SAAS,CACtB,CAEA,SAAS,EAAmB,EAA0B,CACpD,IAAM,EAAS,IAAQ,wBACvB,GAAI,CAAC,GAAU,IAAQ,mCAAqC,IAAA,GAC1D,OAAO,EAET,IAAM,EAAW,EAAkB,CAAM,EACzC,OAAO,EACH,CAAE,GAAG,EAAO,gCAAiC,CAAS,EACtD,CACN,CAEA,SAAS,EAAc,CACrB,SACA,WACA,UACA,kBAMC,CAKD,OAJM,GAAY,EAKhB,EAAC,MAAD,CAAK,UAAU,kCAAf,SAAA,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AK,GACf,EAAC,EAAD,CACE,OAAQ,GACF,OAEN,KAAA,GACU,UACX,EAHM,EAAK,EAGX,CACF,CACC,CAAA,EACF,KACH,EACC,EAAC,SAAD,CACE,UAAU,uCACV,SAAU,EACV,YAAe,EAAS,CAAU,EAClC,KAAK,SAEJ,SAAA,EAAc,WAAa,uBACtB,CAAA,EACN,IACG,GACF,GAEb,CC/eA,SAAgB,EACd,EACkC,CAClC,EAA6B,gBAAiB,CAC5C,WAAY,EAAQ,WACpB,cAAe,EAAQ,cACvB,YAAa,EAAQ,YACrB,KAAM,EACR,CAAC,EACD,IAAM,EAAa,EAAO,EAAQ,OAAO,EACzC,EAAW,QAAU,EAAQ,QAC7B,GAAM,CAAC,GAAU,MACf,EAAoC,CAClC,GAAG,EACH,QAAU,GAAU,EAAW,UAAU,CAAK,CAChD,CAAC,CACH,EACM,CAAC,EAAU,GAAe,EAAS,CAAC,EACpC,CAAC,EAAO,GAAY,EAExB,CAAE,MAAO,KAAM,OAAQ,KAAM,QAAS,EAAK,CAAC,EAE9C,MAAgB,CACd,IAAI,EAAS,GAab,OAZA,EAAO,KAAK,CAAC,CAAC,KACX,GAAW,CACN,GACF,EAAS,CAAE,MAAO,KAAM,SAAQ,QAAS,EAAM,CAAC,CAEpD,EACC,GAA+B,CAC1B,GACF,EAAU,IAAa,CAAE,GAAG,EAAS,QAAO,QAAS,EAAM,EAAE,CAEjE,CACF,MACa,CACX,EAAS,EACX,CACF,EAAG,CAAC,EAAQ,CAAQ,CAAC,EAErB,IAAM,EAAU,MAAkB,CAChC,EAAU,IAAa,CAAE,GAAG,EAAS,MAAO,KAAM,QAAS,EAAK,EAAE,EAClE,EAAa,GAAY,EAAU,CAAC,CACtC,EAAG,CAAC,CAAC,EAEL,MAAO,CAAE,GAAG,EAAO,SAAQ,SAAQ,CACrC"}
|
|
1
|
+
{"version":3,"file":"public-events.js","names":[],"sources":["../src/lockerverse-public-events.tsx","../src/use-lockerverse-public-events.ts"],"sourcesContent":["import type { LockerversePublicEvent } from \"@lockerverse/sdk/public-events\";\nimport {\n CalendarDays,\n CalendarX2,\n Check,\n Copy,\n Facebook,\n Forward,\n Mail,\n} from \"lucide-react\";\nimport { useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport { getAccentContrast } from \"./accent-contrast.ts\";\nimport type { LockerverseStyle, LockerverseTheme } from \"./theme.ts\";\nimport type { UseLockerversePublicEventsResult } from \"./use-lockerverse-public-events.ts\";\n\nexport type LockerversePublicEventsProps = {\n events: UseLockerversePublicEventsResult;\n /** The visible heading. Defaults to Events. */\n title?: string;\n showHeading?: boolean;\n emptyMessage?: string;\n /** Used to show dates and times. Defaults to America/New_York. */\n timeZone?: string;\n theme?: LockerverseTheme;\n style?: LockerverseStyle;\n className?: string;\n};\n\nfunction formatDate(value: string, timeZone: string) {\n return new Intl.DateTimeFormat(\"en-US\", {\n day: \"numeric\",\n month: \"short\",\n timeZone,\n year: \"numeric\",\n }).format(new Date(value));\n}\n\nfunction formatTime(value: string, timeZone: string) {\n return new Intl.DateTimeFormat(\"en-US\", {\n hour: \"numeric\",\n minute: \"2-digit\",\n timeZone,\n timeZoneName: \"short\",\n }).format(new Date(value));\n}\n\nfunction getLink(value: string | null) {\n if (!value) {\n return null;\n }\n try {\n const url = new URL(value);\n return url.protocol === \"https:\" || url.protocol === \"http:\"\n ? url.toString()\n : null;\n } catch {\n return null;\n }\n}\n\nfunction getShareUrl(item: LockerversePublicEvent, past: boolean) {\n const link = getLink(item.link);\n if (link) {\n return link;\n }\n const url = new URL(window.location.href);\n if (past) {\n url.searchParams.set(\"lockerverseEvents\", \"past\");\n } else {\n url.searchParams.delete(\"lockerverseEvents\");\n }\n url.searchParams.delete(\"lockerverseEventOffset\");\n url.hash = `event-${item.id}`;\n return url.toString();\n}\n\nfunction withAccentContrast(style?: LockerverseStyle) {\n const accent = style?.[\"--lockerverse-accent\"];\n if (!accent || style?.[\"--lockerverse-accent-contrast\"] !== undefined) {\n return style;\n }\n const contrast = getAccentContrast(accent);\n return contrast\n ? { ...style, \"--lockerverse-accent-contrast\": contrast }\n : style;\n}\n\nfunction copyWithExecCommand(value: string) {\n const input = document.createElement(\"textarea\");\n input.value = value;\n input.setAttribute(\"readonly\", \"\");\n input.style.position = \"fixed\";\n input.style.opacity = \"0\";\n document.body.appendChild(input);\n try {\n input.select();\n return document.execCommand(\"copy\");\n } catch {\n return false;\n } finally {\n input.remove();\n }\n}\n\nfunction EventActions({\n item,\n past,\n}: {\n item: LockerversePublicEvent;\n past: boolean;\n}) {\n const [copied, setCopied] = useState(false);\n const [manualShareUrl, setManualShareUrl] = useState<string | null>(null);\n const [shareUrl, setShareUrl] = useState<string | null>(null);\n const [shareMenuAbove, setShareMenuAbove] = useState(false);\n const shareActionsRef = useRef<HTMLDivElement>(null);\n const shareTriggerRef = useRef<HTMLButtonElement>(null);\n const link = getLink(item.link);\n const isWithinShareActions = (target: EventTarget | null) =>\n target instanceof Node && shareActionsRef.current?.contains(target);\n\n useEffect(() => {\n if (!shareUrl) {\n return;\n }\n const closeOnOutsideClick = (event: PointerEvent) => {\n if (!isWithinShareActions(event.target)) {\n setShareUrl(null);\n }\n };\n const closeOnEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n setShareUrl(null);\n if (shareActionsRef.current?.contains(document.activeElement)) {\n shareTriggerRef.current?.focus();\n }\n }\n };\n const closeOnFocusOutside = (event: FocusEvent) => {\n if (!isWithinShareActions(event.target)) {\n setShareUrl(null);\n }\n };\n document.addEventListener(\"pointerdown\", closeOnOutsideClick);\n document.addEventListener(\"keydown\", closeOnEscape);\n document.addEventListener(\"focusin\", closeOnFocusOutside);\n return () => {\n document.removeEventListener(\"pointerdown\", closeOnOutsideClick);\n document.removeEventListener(\"keydown\", closeOnEscape);\n document.removeEventListener(\"focusin\", closeOnFocusOutside);\n };\n }, [shareUrl]);\n\n useEffect(() => {\n if (!copied) {\n return;\n }\n const timeout = window.setTimeout(() => setCopied(false), 2200);\n return () => window.clearTimeout(timeout);\n }, [copied]);\n\n async function copyEventLink() {\n if (!shareUrl) {\n return;\n }\n try {\n await navigator.clipboard.writeText(shareUrl);\n setCopied(true);\n setShareUrl(null);\n shareTriggerRef.current?.focus();\n } catch {\n if (copyWithExecCommand(shareUrl)) {\n setCopied(true);\n setShareUrl(null);\n shareTriggerRef.current?.focus();\n } else {\n setManualShareUrl(shareUrl);\n }\n }\n }\n\n return (\n <div className=\"lockerverse-public-events__actions\" ref={shareActionsRef}>\n {link ? (\n <a\n className=\"lockerverse-public-events__link\"\n href={link}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n >\n View event <span aria-hidden=\"true\">↗</span>\n </a>\n ) : null}\n <button\n aria-expanded={shareUrl !== null}\n aria-label={`Share ${item.name}`}\n className=\"lockerverse-public-events__share\"\n data-copied={copied}\n onClick={() => {\n if (!shareUrl && shareTriggerRef.current) {\n setShareMenuAbove(\n window.innerHeight -\n shareTriggerRef.current.getBoundingClientRect().bottom <\n 72\n );\n }\n setShareUrl(shareUrl ? null : getShareUrl(item, past));\n setCopied(false);\n setManualShareUrl(null);\n }}\n ref={shareTriggerRef}\n title={`Share ${item.name}`}\n type=\"button\"\n >\n {copied ? (\n <Check aria-hidden=\"true\" size={22} strokeWidth={2} />\n ) : (\n <Forward aria-hidden=\"true\" size={22} strokeWidth={1.9} />\n )}\n </button>\n {copied ? (\n <span\n className=\"lockerverse-public-events__visually-hidden\"\n role=\"status\"\n >\n Link copied\n </span>\n ) : null}\n {shareUrl ? (\n <fieldset\n className=\"lockerverse-public-events__share-menu\"\n data-above={shareMenuAbove}\n >\n <legend className=\"lockerverse-public-events__visually-hidden\">\n Share {item.name}\n </legend>\n <button\n aria-label=\"Copy event link\"\n onClick={copyEventLink}\n title=\"Copy link\"\n type=\"button\"\n >\n <Copy aria-hidden=\"true\" size={18} />\n </button>\n <a\n aria-label=\"Share by email\"\n href={`mailto:?subject=${encodeURIComponent(item.name)}&body=${encodeURIComponent(shareUrl)}`}\n title=\"Email\"\n >\n <Mail aria-hidden=\"true\" size={18} />\n </a>\n <a\n aria-label=\"Share on Facebook\"\n href={`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n title=\"Facebook\"\n >\n <Facebook aria-hidden=\"true\" size={18} />\n </a>\n <a\n aria-label=\"Share on X\"\n href={`https://twitter.com/intent/tweet?url=${encodeURIComponent(shareUrl)}&text=${encodeURIComponent(item.name)}`}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n title=\"X\"\n >\n <span>𝕏</span>\n </a>\n {manualShareUrl ? (\n <label className=\"lockerverse-public-events__copy-link\">\n Select and copy this event link\n <input\n autoFocus\n onFocus={(event) => event.currentTarget.select()}\n readOnly\n value={manualShareUrl}\n />\n </label>\n ) : null}\n </fieldset>\n ) : null}\n </div>\n );\n}\n\nfunction PublicEventRow({\n item,\n timeZone,\n active,\n past = false,\n}: {\n item: LockerversePublicEvent;\n timeZone: string;\n active: boolean;\n past?: boolean;\n}) {\n const [expanded, setExpanded] = useState(false);\n const start = new Date(item.startAt);\n const month = new Intl.DateTimeFormat(\"en-US\", {\n month: \"short\",\n timeZone,\n }).format(start);\n const day = new Intl.DateTimeFormat(\"en-US\", {\n day: \"numeric\",\n timeZone,\n }).format(start);\n const year = new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n year: \"numeric\",\n }).format(start);\n const startDateLabel = formatDate(item.startAt, timeZone);\n const sameDay = startDateLabel === formatDate(item.endAt, timeZone);\n const endLabel = sameDay\n ? formatTime(item.endAt, timeZone)\n : `${formatDate(item.endAt, timeZone)} at ${formatTime(item.endAt, timeZone)}`;\n const imageUrl = getLink(item.imageUrl);\n const canExpand = (item.description?.length ?? 0) > 130;\n\n return (\n <li className=\"lockerverse-public-events__item\" id={`event-${item.id}`}>\n <article className=\"lockerverse-public-events__row\">\n {imageUrl ? (\n <img\n alt=\"\"\n className=\"lockerverse-public-events__image\"\n height={124}\n loading=\"lazy\"\n src={imageUrl}\n width={154}\n />\n ) : (\n <time\n className=\"lockerverse-public-events__date\"\n dateTime={item.startAt}\n >\n <span className=\"lockerverse-public-events__month\">{month}</span>\n <span className=\"lockerverse-public-events__day\">{day}</span>\n <span className=\"lockerverse-public-events__year\">{year}</span>\n </time>\n )}\n <div className=\"lockerverse-public-events__content\">\n <div className=\"lockerverse-public-events__heading\">\n <h3>{item.name}</h3>\n {active ? (\n <span className=\"lockerverse-public-events__live\">Live now</span>\n ) : null}\n </div>\n <p className=\"lockerverse-public-events__schedule\">\n {imageUrl ? (\n <>\n <time dateTime={item.startAt}>{startDateLabel}</time>\n <span aria-hidden=\"true\"> · </span>\n </>\n ) : null}\n <time dateTime={item.startAt}>\n {formatTime(item.startAt, timeZone)}\n </time>\n <span aria-hidden=\"true\"> — </span>\n <time dateTime={item.endAt}>{endLabel}</time>\n </p>\n {item.location ? (\n <p className=\"lockerverse-public-events__place\">{item.location}</p>\n ) : null}\n {item.description ? (\n <>\n <p\n className={[\n \"lockerverse-public-events__description\",\n canExpand && !expanded\n ? \"lockerverse-public-events__description--clamped\"\n : \"\",\n ]\n .filter(Boolean)\n .join(\" \")}\n >\n {item.description}\n </p>\n {canExpand ? (\n <button\n aria-expanded={expanded}\n className=\"lockerverse-public-events__more\"\n onClick={() => setExpanded(!expanded)}\n type=\"button\"\n >\n {expanded ? \"Show less\" : \"Read more\"}\n </button>\n ) : null}\n </>\n ) : null}\n </div>\n <EventActions item={item} past={past} />\n </article>\n </li>\n );\n}\n\n/** Optional public list that can be embedded in any React site. */\nexport function LockerversePublicEvents({\n events,\n title = \"Events\",\n showHeading = true,\n emptyMessage = \"No events yet.\",\n timeZone = \"America/New_York\",\n theme = \"dark\",\n style,\n className,\n}: LockerversePublicEventsProps) {\n const [now, setNow] = useState(() => Date.now());\n const [view, setView] = useState<\"current\" | \"past\">(\"current\");\n const [pastEvents, setPastEvents] = useState<LockerversePublicEvent[]>([]);\n const [pastOffset, setPastOffset] = useState(0);\n const [pastHasMore, setPastHasMore] = useState(false);\n const [pastLoaded, setPastLoaded] = useState(false);\n const [pastLoading, setPastLoading] = useState(false);\n const [pastError, setPastError] = useState<string | null>(null);\n const [pastTarget, setPastTarget] = useState<string | null>(null);\n const tabId = useId();\n\n const loadPast = useCallback(\n async (offset: number, reset = false) => {\n setPastLoading(true);\n setPastError(null);\n try {\n const page = await events.client.listPast({ offset });\n setPastEvents((current) =>\n reset ? page.events : [...current, ...page.events]\n );\n setPastOffset(offset + page.events.length);\n setPastHasMore(page.hasMore);\n setPastLoaded(true);\n } catch (error) {\n setPastError(\n error instanceof Error ? error.message : \"Unable to load past events.\"\n );\n } finally {\n setPastLoading(false);\n }\n },\n [events.client]\n );\n\n useEffect(() => {\n const interval = window.setInterval(() => setNow(Date.now()), 60_000);\n return () => window.clearInterval(interval);\n }, []);\n\n useEffect(() => {\n const url = new URL(window.location.href);\n if (url.searchParams.get(\"lockerverseEvents\") !== \"past\") {\n return;\n }\n setView(\"past\");\n setPastTarget(url.hash.slice(1));\n loadPast(0, true);\n }, [loadPast]);\n\n useEffect(() => {\n const hash = window.location.hash.slice(1);\n if (!hash.startsWith(\"event-\")) {\n return;\n }\n if (view === \"current\") {\n document.getElementById(hash)?.scrollIntoView({ block: \"center\" });\n return;\n }\n if (!pastTarget || pastLoading || !pastLoaded) {\n return;\n }\n const target = document.getElementById(pastTarget);\n if (target) {\n target.scrollIntoView({ block: \"center\" });\n setPastTarget(null);\n } else if (pastHasMore) {\n loadPast(pastOffset);\n } else {\n setPastTarget(null);\n }\n }, [\n events.events,\n loadPast,\n pastHasMore,\n pastLoaded,\n pastLoading,\n pastOffset,\n pastTarget,\n view,\n ]);\n\n function openPast() {\n setView(\"past\");\n if (pastLoaded || pastLoading) {\n return;\n }\n loadPast(0, true);\n }\n\n const availableEvents = events.events || [];\n const activeEvents = availableEvents.filter(\n (item) =>\n new Date(item.startAt).getTime() <= now &&\n new Date(item.endAt).getTime() > now\n );\n const upcomingEvents = availableEvents.filter(\n (item) => new Date(item.startAt).getTime() > now\n );\n\n return (\n <section\n aria-busy={view === \"past\" ? pastLoading : events.loading}\n aria-label={title}\n className={[\"lockerverse-public-events\", className]\n .filter(Boolean)\n .join(\" \")}\n data-lockerverse-theme={theme}\n style={withAccentContrast(style)}\n >\n <div className=\"lockerverse-public-events__layout\">\n {showHeading ? <h2>{title}</h2> : null}\n <nav\n aria-label=\"Event views\"\n className=\"lockerverse-public-events__tabs\"\n >\n <button\n aria-controls={`${tabId}-current-panel`}\n aria-pressed={view === \"current\"}\n className=\"lockerverse-public-events__tab\"\n id={`${tabId}-current-tab`}\n onClick={() => setView(\"current\")}\n type=\"button\"\n >\n <CalendarDays aria-hidden=\"true\" size={18} />\n Upcoming Events\n </button>\n <button\n aria-controls={`${tabId}-past-panel`}\n aria-pressed={view === \"past\"}\n className=\"lockerverse-public-events__tab\"\n id={`${tabId}-past-tab`}\n onClick={openPast}\n type=\"button\"\n >\n <CalendarX2 aria-hidden=\"true\" size={18} />\n Past Events\n </button>\n </nav>\n <section\n aria-labelledby={`${tabId}-current-tab`}\n hidden={view !== \"current\"}\n id={`${tabId}-current-panel`}\n >\n {events.loading && !events.events ? (\n <p role=\"status\">Loading events…</p>\n ) : null}\n {events.error ? (\n <div role=\"alert\">\n <p>{events.error.message}</p>\n <button onClick={events.refresh} type=\"button\">\n Try again\n </button>\n </div>\n ) : null}\n {events.events &&\n activeEvents.length === 0 &&\n upcomingEvents.length === 0 ? (\n <p className=\"lockerverse-public-events__empty\">{emptyMessage}</p>\n ) : null}\n {activeEvents.length > 0 ? (\n <div className=\"lockerverse-public-events__group\">\n <ol className=\"lockerverse-public-events__list\">\n {activeEvents.map((item) => (\n <PublicEventRow\n active\n item={item}\n key={item.id}\n timeZone={timeZone}\n />\n ))}\n </ol>\n </div>\n ) : null}\n {upcomingEvents.length > 0 ? (\n <div className=\"lockerverse-public-events__group\">\n <ol className=\"lockerverse-public-events__list\">\n {upcomingEvents.map((item) => (\n <PublicEventRow\n active={false}\n item={item}\n key={item.id}\n timeZone={timeZone}\n />\n ))}\n </ol>\n </div>\n ) : null}\n </section>\n <section\n aria-labelledby={`${tabId}-past-tab`}\n hidden={view !== \"past\"}\n id={`${tabId}-past-panel`}\n >\n {pastError ? (\n <div role=\"alert\">\n <p>{pastError}</p>\n <button\n onClick={() =>\n loadPast(pastLoaded ? pastOffset : 0, !pastLoaded)\n }\n type=\"button\"\n >\n Try again\n </button>\n </div>\n ) : null}\n {pastLoading && !pastLoaded ? (\n <p role=\"status\">Loading past events…</p>\n ) : null}\n {pastLoaded && pastEvents.length === 0 ? (\n <p className=\"lockerverse-public-events__empty\">\n No past events yet.\n </p>\n ) : null}\n {pastEvents.length > 0 ? (\n <ol className=\"lockerverse-public-events__list\">\n {pastEvents.map((item) => (\n <PublicEventRow\n active={false}\n item={item}\n key={item.id}\n past\n timeZone={timeZone}\n />\n ))}\n </ol>\n ) : null}\n {pastHasMore ? (\n <button\n className=\"lockerverse-public-events__load-more\"\n disabled={pastLoading}\n onClick={() => loadPast(pastOffset)}\n type=\"button\"\n >\n {pastLoading ? \"Loading…\" : \"Load more past events\"}\n </button>\n ) : null}\n </section>\n </div>\n </section>\n );\n}\n","import {\n type CreateLockerversePublicEventsOptions,\n createLockerversePublicEventsClient,\n type LockerversePublicEvent,\n type LockerversePublicEventsClient,\n type LockerverseSdkError,\n} from \"@lockerverse/sdk/public-events\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useImmutableResourceIdentity } from \"./immutable-resource-identity.ts\";\n\nexport type UseLockerversePublicEventsResult = {\n client: LockerversePublicEventsClient;\n events: LockerversePublicEvent[] | null;\n loading: boolean;\n error: LockerverseSdkError | null;\n refresh: () => void;\n};\n\n/** Load the public events list for one community. */\nexport function useLockerversePublicEvents(\n options: CreateLockerversePublicEventsOptions\n): UseLockerversePublicEventsResult {\n useImmutableResourceIdentity(\"public events\", {\n apiBaseUrl: options.apiBaseUrl,\n communitySlug: options.communitySlug,\n environment: options.environment,\n slug: \"\",\n });\n const onErrorRef = useRef(options.onError);\n onErrorRef.current = options.onError;\n const [client] = useState(() =>\n createLockerversePublicEventsClient({\n ...options,\n onError: (error) => onErrorRef.current?.(error),\n })\n );\n const [revision, setRevision] = useState(0);\n const [state, setState] = useState<\n Pick<UseLockerversePublicEventsResult, \"events\" | \"loading\" | \"error\">\n >({ error: null, events: null, loading: true });\n\n useEffect(() => {\n let active = true;\n client.list().then(\n (events) => {\n if (active) {\n setState({ error: null, events, loading: false });\n }\n },\n (error: LockerverseSdkError) => {\n if (active) {\n setState((current) => ({ ...current, error, loading: false }));\n }\n }\n );\n return () => {\n active = false;\n };\n }, [client, revision]);\n\n const refresh = useCallback(() => {\n setState((current) => ({ ...current, error: null, loading: true }));\n setRevision((current) => current + 1);\n }, []);\n\n return { ...state, client, refresh };\n}\n"],"mappings":"4bA4BA,SAAS,EAAW,EAAe,EAAkB,CACnD,OAAO,IAAI,KAAK,eAAe,QAAS,CACtC,IAAK,UACL,MAAO,QACP,WACA,KAAM,SACR,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,CAAK,CAAC,CAC3B,CAEA,SAAS,EAAW,EAAe,EAAkB,CACnD,OAAO,IAAI,KAAK,eAAe,QAAS,CACtC,KAAM,UACN,OAAQ,UACR,WACA,aAAc,OAChB,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,CAAK,CAAC,CAC3B,CAEA,SAAS,EAAQ,EAAsB,CACrC,GAAI,CAAC,EACH,OAAO,KAET,GAAI,CACF,IAAM,EAAM,IAAI,IAAI,CAAK,EACzB,OAAO,EAAI,WAAa,UAAY,EAAI,WAAa,QACjD,EAAI,SAAS,EACb,IACN,MAAQ,CACN,OAAO,IACT,CACF,CAEA,SAAS,EAAY,EAA8B,EAAe,CAChE,IAAM,EAAO,EAAQ,EAAK,IAAI,EAC9B,GAAI,EACF,OAAO,EAET,IAAM,EAAM,IAAI,IAAI,OAAO,SAAS,IAAI,EAQxC,OAPI,EACF,EAAI,aAAa,IAAI,oBAAqB,MAAM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,GAA+B,CAC1B,GACF,EAAU,IAAa,CAAE,GAAG,EAAS,QAAO,QAAS,EAAM,EAAE,CAEjE,CACF,MACa,CACX,EAAS,EACX,CACF,EAAG,CAAC,EAAQ,CAAQ,CAAC,EAErB,IAAM,EAAU,MAAkB,CAChC,EAAU,IAAa,CAAE,GAAG,EAAS,MAAO,KAAM,QAAS,EAAK,EAAE,EAClE,EAAa,GAAY,EAAU,CAAC,CACtC,EAAG,CAAC,CAAC,EAEL,MAAO,CAAE,GAAG,EAAO,SAAQ,SAAQ,CACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lockerverse/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.133-dev.1",
|
|
4
4
|
"description": "Tree-shakable React payment and signup UI for Lockerverse",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"embla-carousel-react": "8.6.0",
|
|
128
128
|
"lucide-react": "0.536.0",
|
|
129
129
|
"valibot": "1.4.2",
|
|
130
|
-
"@lockerverse/sdk": "0.2.
|
|
130
|
+
"@lockerverse/sdk": "0.2.133-dev.1"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": {
|
|
133
133
|
"@size-limit/file": "13.0.3",
|