@wodira/browser 1.1.0 → 1.2.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/CHANGELOG.md +24 -1
- package/README.md +106 -1
- package/dist/index.cjs +36 -0
- package/dist/index.d.ts +90 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/boxes/cdn.js +15 -15
- package/dist/ui/components.d.ts +18 -1
- package/dist/ui/components.d.ts.map +1 -1
- package/dist/ui/events.d.ts +1 -1
- package/dist/ui/events.d.ts.map +1 -1
- package/dist/ui/i18n.d.ts +1 -1
- package/dist/ui/i18n.d.ts.map +1 -1
- package/dist/ui/{index-tfej862z.js → index-1zshfsk6.js} +45 -1563
- package/dist/ui/index-3qe91gk8.js +1625 -0
- package/dist/ui/index-bjb0t7yn.js +1624 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +290 -125
- package/dist/ui/map-view-rn3jgtqn.js +28737 -0
- package/dist/ui/maplibre-gl-worker.mjs +10 -0
- package/dist/ui/route-3d/cdn.d.ts +2 -0
- package/dist/ui/route-3d/cdn.d.ts.map +1 -0
- package/dist/ui/route-3d/cdn.js +1527 -0
- package/dist/ui/route-3d/gpx.d.ts +14 -0
- package/dist/ui/route-3d/gpx.d.ts.map +1 -0
- package/dist/ui/route-3d/index.d.ts +12 -0
- package/dist/ui/route-3d/index.d.ts.map +1 -0
- package/dist/ui/route-3d/index.js +16 -0
- package/dist/ui/route-3d/map-view.d.ts +73 -0
- package/dist/ui/route-3d/map-view.d.ts.map +1 -0
- package/dist/ui/route-3d/maplibre-gl-worker.mjs +10 -0
- package/dist/ui/route-3d/route-3d.d.ts +168 -0
- package/dist/ui/route-3d/route-3d.d.ts.map +1 -0
- package/dist/ui/route-3d/route-geo.d.ts +77 -0
- package/dist/ui/route-3d/route-geo.d.ts.map +1 -0
- package/dist/ui/shirt-sponsors/cdn.js +29 -27
- package/dist/ui/shirt-sponsors/index.js +5 -3
- package/dist/ui/shirt-sponsors/shirt-auction.d.ts +19 -0
- package/dist/ui/shirt-sponsors/shirt-auction.d.ts.map +1 -1
- package/package.json +15 -6
|
@@ -1513,6 +1513,14 @@ if (DEV_MODE3 && global4.litElementVersions.length > 1) {
|
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
1515
1515
|
// ../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/development/directive.js
|
|
1516
|
+
var PartType = {
|
|
1517
|
+
ATTRIBUTE: 1,
|
|
1518
|
+
CHILD: 2,
|
|
1519
|
+
PROPERTY: 3,
|
|
1520
|
+
BOOLEAN_ATTRIBUTE: 4,
|
|
1521
|
+
EVENT: 5,
|
|
1522
|
+
ELEMENT: 6
|
|
1523
|
+
};
|
|
1516
1524
|
var directive = (c) => (...values) => ({
|
|
1517
1525
|
["_$litDirective$"]: c,
|
|
1518
1526
|
values
|
|
@@ -1536,32 +1544,6 @@ class Directive {
|
|
|
1536
1544
|
}
|
|
1537
1545
|
}
|
|
1538
1546
|
|
|
1539
|
-
// ../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/development/directive-helpers.js
|
|
1540
|
-
var { _ChildPart: ChildPart2 } = _$LH;
|
|
1541
|
-
var ENABLE_SHADYDOM_NOPATCH2 = true;
|
|
1542
|
-
var wrap2 = ENABLE_SHADYDOM_NOPATCH2 && window.ShadyDOM?.inUse && window.ShadyDOM?.noPatch === true ? window.ShadyDOM.wrap : (node) => node;
|
|
1543
|
-
var RESET_VALUE = {};
|
|
1544
|
-
var setCommittedValue = (part, value = RESET_VALUE) => part._$committedValue = value;
|
|
1545
|
-
|
|
1546
|
-
// ../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/development/directives/keyed.js
|
|
1547
|
-
class Keyed extends Directive {
|
|
1548
|
-
constructor() {
|
|
1549
|
-
super(...arguments);
|
|
1550
|
-
this.key = nothing;
|
|
1551
|
-
}
|
|
1552
|
-
render(k, v) {
|
|
1553
|
-
this.key = k;
|
|
1554
|
-
return v;
|
|
1555
|
-
}
|
|
1556
|
-
update(part, [k, v]) {
|
|
1557
|
-
if (k !== this.key) {
|
|
1558
|
-
setCommittedValue(part);
|
|
1559
|
-
this.key = k;
|
|
1560
|
-
}
|
|
1561
|
-
return v;
|
|
1562
|
-
}
|
|
1563
|
-
}
|
|
1564
|
-
var keyed = directive(Keyed);
|
|
1565
1547
|
// src/index.ts
|
|
1566
1548
|
class WodiraBrowserApiError extends Error {
|
|
1567
1549
|
status;
|
|
@@ -1611,6 +1593,38 @@ class WodiraBrowserClient {
|
|
|
1611
1593
|
signal
|
|
1612
1594
|
});
|
|
1613
1595
|
}
|
|
1596
|
+
getEventRoutes(eventId, signal) {
|
|
1597
|
+
return this.request(`/events/${encodeURIComponent(eventId)}/routes`, {
|
|
1598
|
+
signal
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
eventRouteGpxUrl(eventId, routeId) {
|
|
1602
|
+
return `${this.baseUrl}/events/${encodeURIComponent(eventId)}/routes/${encodeURIComponent(routeId)}/gpx`;
|
|
1603
|
+
}
|
|
1604
|
+
getEventShirtSponsorCampaign(eventId, signal) {
|
|
1605
|
+
return this.request(`/events/${encodeURIComponent(eventId)}/shirt-sponsor`, { signal, credentials: "omit", cache: "no-store" });
|
|
1606
|
+
}
|
|
1607
|
+
requestShirtGuestCode(eventId, input, signal) {
|
|
1608
|
+
return this.shirtGuestPost(eventId, "code", input, signal);
|
|
1609
|
+
}
|
|
1610
|
+
verifyShirtGuestCode(eventId, input, signal) {
|
|
1611
|
+
return this.shirtGuestPost(eventId, "verify", input, signal);
|
|
1612
|
+
}
|
|
1613
|
+
createShirtGuestCheckout(eventId, input, signal) {
|
|
1614
|
+
return this.shirtGuestPost(eventId, "checkout", input, signal);
|
|
1615
|
+
}
|
|
1616
|
+
getShirtGuestCheckoutStatus(eventId, input, signal) {
|
|
1617
|
+
return this.shirtGuestPost(eventId, "status", input, signal);
|
|
1618
|
+
}
|
|
1619
|
+
shirtGuestPost(eventId, step, input, signal) {
|
|
1620
|
+
return this.request(`/events/${encodeURIComponent(eventId)}/shirt-sponsor/guest/${step}`, {
|
|
1621
|
+
method: "POST",
|
|
1622
|
+
body: input,
|
|
1623
|
+
signal,
|
|
1624
|
+
credentials: "omit",
|
|
1625
|
+
cache: "no-store"
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1614
1628
|
getPricingCards(eventId, signal) {
|
|
1615
1629
|
return this.request(`/events/${encodeURIComponent(eventId)}/pricing-cards`, { signal });
|
|
1616
1630
|
}
|
|
@@ -1660,6 +1674,10 @@ class WodiraBrowserClient {
|
|
|
1660
1674
|
headers.set("accept", "application/json");
|
|
1661
1675
|
headers.set("x-publishable-key", this.publishableKey);
|
|
1662
1676
|
const init = { method: options.method ?? "GET", headers };
|
|
1677
|
+
if (options.credentials)
|
|
1678
|
+
init.credentials = options.credentials;
|
|
1679
|
+
if (options.cache)
|
|
1680
|
+
init.cache = options.cache;
|
|
1663
1681
|
if (options.signal)
|
|
1664
1682
|
init.signal = options.signal;
|
|
1665
1683
|
if (options.body !== undefined) {
|
|
@@ -1725,1540 +1743,4 @@ function serializeAthleteInput(athlete) {
|
|
|
1725
1743
|
};
|
|
1726
1744
|
}
|
|
1727
1745
|
|
|
1728
|
-
|
|
1729
|
-
var wodiraUiStyles = css`
|
|
1730
|
-
:host {
|
|
1731
|
-
box-sizing: border-box;
|
|
1732
|
-
color: var(--wodira-color-text, #17132e);
|
|
1733
|
-
display: block;
|
|
1734
|
-
font-family: var(--wodira-font-family, inherit);
|
|
1735
|
-
font-size: var(--wodira-font-size, 1rem);
|
|
1736
|
-
line-height: 1.5;
|
|
1737
|
-
container-type: inline-size;
|
|
1738
|
-
min-width: 0;
|
|
1739
|
-
overflow-wrap: anywhere;
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
*,
|
|
1743
|
-
*::before,
|
|
1744
|
-
*::after {
|
|
1745
|
-
box-sizing: inherit;
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
[hidden] {
|
|
1749
|
-
display: none !important;
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
[part~='stack'] {
|
|
1753
|
-
display: grid;
|
|
1754
|
-
gap: var(--wodira-space, 1rem);
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
[part~='grid'] {
|
|
1758
|
-
display: grid;
|
|
1759
|
-
gap: var(--wodira-space, 1rem);
|
|
1760
|
-
grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--wodira-grid-min, 15rem)), 1fr));
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
[part~='card'] {
|
|
1764
|
-
background: var(--wodira-color-surface, #fff);
|
|
1765
|
-
border: 1px solid var(--wodira-color-border, #dcd9e3);
|
|
1766
|
-
border-radius: var(--wodira-radius, 1rem);
|
|
1767
|
-
box-shadow: var(--wodira-shadow, 0 4px 18px rgb(23 19 46 / 0.04));
|
|
1768
|
-
padding: var(--wodira-card-padding, clamp(1rem, 3cqi, 1.75rem));
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
[part~='button'] {
|
|
1772
|
-
align-items: center;
|
|
1773
|
-
background: var(--wodira-color-primary, #17132e);
|
|
1774
|
-
border: 0;
|
|
1775
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
1776
|
-
color: var(--wodira-color-primary-contrast, #fff);
|
|
1777
|
-
cursor: pointer;
|
|
1778
|
-
display: inline-flex;
|
|
1779
|
-
font: inherit;
|
|
1780
|
-
font-weight: 700;
|
|
1781
|
-
justify-content: center;
|
|
1782
|
-
min-height: var(--wodira-control-height, 2.75rem);
|
|
1783
|
-
padding: 0.75rem 1rem;
|
|
1784
|
-
transition:
|
|
1785
|
-
opacity 0.2s ease,
|
|
1786
|
-
transform 0.2s ease;
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
[part~='button']:hover:not(:disabled) {
|
|
1790
|
-
transform: translateY(-1px);
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
[part~='button']:focus-visible,
|
|
1794
|
-
[part~='input']:focus-visible,
|
|
1795
|
-
[part~='select']:focus-visible,
|
|
1796
|
-
[part~='textarea']:focus-visible,
|
|
1797
|
-
[part~='checkbox']:focus-visible {
|
|
1798
|
-
outline: 3px solid color-mix(in srgb, var(--wodira-color-accent, #c40072) 35%, transparent);
|
|
1799
|
-
outline-offset: 2px;
|
|
1800
|
-
}
|
|
1801
|
-
|
|
1802
|
-
[part~='button']:disabled {
|
|
1803
|
-
cursor: not-allowed;
|
|
1804
|
-
opacity: 0.6;
|
|
1805
|
-
}
|
|
1806
|
-
|
|
1807
|
-
[part~='button'][part~='secondary'] {
|
|
1808
|
-
background: var(--wodira-color-muted, #f6f5f8);
|
|
1809
|
-
color: var(--wodira-color-text, #17132e);
|
|
1810
|
-
}
|
|
1811
|
-
|
|
1812
|
-
[part~='text-button'] {
|
|
1813
|
-
justify-self: start;
|
|
1814
|
-
min-height: auto;
|
|
1815
|
-
padding: 0.45rem 0.7rem;
|
|
1816
|
-
width: auto;
|
|
1817
|
-
}
|
|
1818
|
-
|
|
1819
|
-
[part~='input'],
|
|
1820
|
-
[part~='select'],
|
|
1821
|
-
[part~='textarea'] {
|
|
1822
|
-
background: var(--wodira-color-surface, #fff);
|
|
1823
|
-
border: 1px solid var(--wodira-color-border, #dcd9e3);
|
|
1824
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
1825
|
-
color: var(--wodira-color-text, #17132e);
|
|
1826
|
-
font: inherit;
|
|
1827
|
-
min-height: var(--wodira-control-height, 2.75rem);
|
|
1828
|
-
padding: 0.7rem 0.8rem;
|
|
1829
|
-
width: 100%;
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
[part~='input'][aria-invalid='true'],
|
|
1833
|
-
[part~='select'][aria-invalid='true'],
|
|
1834
|
-
[part~='textarea'][aria-invalid='true'] {
|
|
1835
|
-
border-color: var(--wodira-color-danger, #b42318);
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
[part~='textarea'] {
|
|
1839
|
-
min-height: 5.5rem;
|
|
1840
|
-
resize: vertical;
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
|
-
[part~='label'] {
|
|
1844
|
-
display: grid;
|
|
1845
|
-
gap: 0.35rem;
|
|
1846
|
-
font-size: 0.92rem;
|
|
1847
|
-
font-weight: 700;
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
[part~='checkbox'] {
|
|
1851
|
-
margin-inline-end: 0.5rem;
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
[part~='email-field'] {
|
|
1855
|
-
min-width: 0;
|
|
1856
|
-
}
|
|
1857
|
-
[part~='email-suggestion'] {
|
|
1858
|
-
display: flex;
|
|
1859
|
-
flex-wrap: wrap;
|
|
1860
|
-
align-items: center;
|
|
1861
|
-
gap: 0.25rem;
|
|
1862
|
-
margin-top: 0.5rem;
|
|
1863
|
-
}
|
|
1864
|
-
[part~='email-correction'] {
|
|
1865
|
-
background: transparent;
|
|
1866
|
-
color: var(--wodira-color-accent, #c40072);
|
|
1867
|
-
min-height: 2.75rem;
|
|
1868
|
-
max-width: 100%;
|
|
1869
|
-
padding: 0.25rem 0.5rem;
|
|
1870
|
-
overflow-wrap: anywhere;
|
|
1871
|
-
}
|
|
1872
|
-
[part~='email-delivery'] {
|
|
1873
|
-
overflow-wrap: anywhere;
|
|
1874
|
-
margin-top: 0.5rem;
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
|
-
[part~='hint'],
|
|
1878
|
-
[part~='meta'],
|
|
1879
|
-
[part~='field-error'] {
|
|
1880
|
-
color: var(--wodira-color-text-muted, #625e70);
|
|
1881
|
-
font-size: 0.875rem;
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
[part~='description'] {
|
|
1885
|
-
color: var(--wodira-color-text-muted, #625e70);
|
|
1886
|
-
display: grid;
|
|
1887
|
-
font-size: 0.95rem;
|
|
1888
|
-
gap: 0.55rem;
|
|
1889
|
-
line-height: 1.65;
|
|
1890
|
-
}
|
|
1891
|
-
|
|
1892
|
-
[part~='description'] p {
|
|
1893
|
-
margin: 0;
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
[part~='description-heading'] {
|
|
1897
|
-
color: var(--wodira-color-text, #17132e);
|
|
1898
|
-
font-weight: 800;
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1901
|
-
[part~='description-list'] {
|
|
1902
|
-
display: grid;
|
|
1903
|
-
gap: 0.3rem;
|
|
1904
|
-
margin: 0;
|
|
1905
|
-
padding-inline-start: 1.15rem;
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
[part~='event-card-description'] {
|
|
1909
|
-
display: -webkit-box;
|
|
1910
|
-
margin: 0;
|
|
1911
|
-
max-width: 65ch;
|
|
1912
|
-
overflow: hidden;
|
|
1913
|
-
-webkit-box-orient: vertical;
|
|
1914
|
-
-webkit-line-clamp: var(--wodira-event-card-description-lines, 4);
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
[part~='event-card-description-full'] {
|
|
1918
|
-
margin: 0;
|
|
1919
|
-
max-width: 65ch;
|
|
1920
|
-
}
|
|
1921
|
-
|
|
1922
|
-
[part~='inline-code'] {
|
|
1923
|
-
background: var(--wodira-color-muted, #f6f5f8);
|
|
1924
|
-
border-radius: 0.35rem;
|
|
1925
|
-
color: var(--wodira-color-text, #17132e);
|
|
1926
|
-
font-family:
|
|
1927
|
-
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
|
|
1928
|
-
font-size: 0.9em;
|
|
1929
|
-
padding: 0.08rem 0.28rem;
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1932
|
-
[part~='field-error'] {
|
|
1933
|
-
color: var(--wodira-color-danger, #b42318);
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
[part~='eligibility-summary'] {
|
|
1937
|
-
background: color-mix(
|
|
1938
|
-
in srgb,
|
|
1939
|
-
var(--wodira-color-accent, #c40072) 7%,
|
|
1940
|
-
var(--wodira-color-surface, #fff)
|
|
1941
|
-
);
|
|
1942
|
-
border: 1px solid color-mix(in srgb, var(--wodira-color-accent, #c40072) 24%, transparent);
|
|
1943
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
1944
|
-
display: grid;
|
|
1945
|
-
gap: 0.45rem;
|
|
1946
|
-
padding: 0.8rem 0.9rem;
|
|
1947
|
-
}
|
|
1948
|
-
|
|
1949
|
-
[part~='eligibility-summary'] ul {
|
|
1950
|
-
color: var(--wodira-color-text-muted, #625e70);
|
|
1951
|
-
display: grid;
|
|
1952
|
-
font-size: 0.875rem;
|
|
1953
|
-
gap: 0.25rem;
|
|
1954
|
-
margin: 0;
|
|
1955
|
-
padding-inline-start: 1.2rem;
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
[part~='gender-composition'] {
|
|
1959
|
-
border: 0;
|
|
1960
|
-
display: grid;
|
|
1961
|
-
gap: 0.6rem;
|
|
1962
|
-
margin: 0;
|
|
1963
|
-
padding: 0;
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
[part~='gender-composition'] legend {
|
|
1967
|
-
font-weight: 800;
|
|
1968
|
-
padding: 0;
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
[part~='gender-composition'] [part~='hint'] {
|
|
1972
|
-
margin: 0;
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
[part~='composition-options'] {
|
|
1976
|
-
display: grid;
|
|
1977
|
-
gap: 0.6rem;
|
|
1978
|
-
grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.25rem), 1fr));
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
[part~='composition-option'] {
|
|
1982
|
-
align-items: center;
|
|
1983
|
-
background: var(--wodira-color-surface, #fff);
|
|
1984
|
-
border: 1px solid var(--wodira-color-border, #dcd9e3);
|
|
1985
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
1986
|
-
cursor: pointer;
|
|
1987
|
-
display: flex;
|
|
1988
|
-
font-weight: 700;
|
|
1989
|
-
gap: 0.55rem;
|
|
1990
|
-
min-height: var(--wodira-control-height, 2.75rem);
|
|
1991
|
-
padding: 0.7rem 0.8rem;
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
[part~='composition-option'][part~='selected'] {
|
|
1995
|
-
background: color-mix(
|
|
1996
|
-
in srgb,
|
|
1997
|
-
var(--wodira-color-accent, #c40072) 10%,
|
|
1998
|
-
var(--wodira-color-surface, #fff)
|
|
1999
|
-
);
|
|
2000
|
-
border-color: var(--wodira-color-accent, #c40072);
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
[part~='composition-option']:focus-within {
|
|
2004
|
-
outline: 3px solid color-mix(in srgb, var(--wodira-color-accent, #c40072) 35%, transparent);
|
|
2005
|
-
outline-offset: 2px;
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
[part~='participant-mode'] {
|
|
2009
|
-
background: var(--wodira-color-muted, #f6f5f8);
|
|
2010
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
2011
|
-
display: grid;
|
|
2012
|
-
gap: 0.25rem;
|
|
2013
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
2014
|
-
margin-block: 0.8rem;
|
|
2015
|
-
padding: 0.25rem;
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
[part~='participant-mode-button'] {
|
|
2019
|
-
background: transparent;
|
|
2020
|
-
border: 1px solid transparent;
|
|
2021
|
-
border-radius: calc(var(--wodira-radius-sm, 0.625rem) * 0.75);
|
|
2022
|
-
color: var(--wodira-color-text-muted, #625e70);
|
|
2023
|
-
cursor: pointer;
|
|
2024
|
-
font: inherit;
|
|
2025
|
-
font-size: 0.875rem;
|
|
2026
|
-
font-weight: 750;
|
|
2027
|
-
min-height: 2.4rem;
|
|
2028
|
-
padding: 0.55rem 0.75rem;
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
[part~='participant-mode-button'][part~='active'] {
|
|
2032
|
-
background: var(--wodira-color-surface, #fff);
|
|
2033
|
-
border-color: var(--wodira-color-border, #dcd9e3);
|
|
2034
|
-
box-shadow: 0 2px 8px rgb(15 23 42 / 0.08);
|
|
2035
|
-
color: var(--wodira-color-text, #17132e);
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
[part~='participant-mode-button']:focus-visible {
|
|
2039
|
-
outline: 3px solid color-mix(in srgb, var(--wodira-color-accent, #c40072) 35%, transparent);
|
|
2040
|
-
outline-offset: 2px;
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
[part~='deferred-participant-hint'] {
|
|
2044
|
-
background: var(--wodira-color-muted, #f6f5f8);
|
|
2045
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
2046
|
-
color: var(--wodira-color-text-muted, #625e70);
|
|
2047
|
-
line-height: 1.5;
|
|
2048
|
-
margin: 0.8rem 0 0;
|
|
2049
|
-
padding: 0.8rem 0.9rem;
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
[part~='error'] {
|
|
2053
|
-
background: color-mix(in srgb, var(--wodira-color-danger, #b42318) 10%, transparent);
|
|
2054
|
-
border: 1px solid color-mix(in srgb, var(--wodira-color-danger, #b42318) 35%, transparent);
|
|
2055
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
2056
|
-
color: var(--wodira-color-danger, #b42318);
|
|
2057
|
-
padding: 0.75rem 0.9rem;
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
[part~='success'] {
|
|
2061
|
-
background: color-mix(in srgb, var(--wodira-color-success, #16703c) 12%, transparent);
|
|
2062
|
-
border: 1px solid color-mix(in srgb, var(--wodira-color-success, #16703c) 35%, transparent);
|
|
2063
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
2064
|
-
color: var(--wodira-color-success, #16703c);
|
|
2065
|
-
padding: 0.75rem 0.9rem;
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
[part~='loader'],
|
|
2069
|
-
[part~='empty'] {
|
|
2070
|
-
color: var(--wodira-color-text-muted, #625e70);
|
|
2071
|
-
padding: var(--wodira-space, 1rem);
|
|
2072
|
-
text-align: center;
|
|
2073
|
-
}
|
|
2074
|
-
|
|
2075
|
-
[part~='title'] {
|
|
2076
|
-
font-size: clamp(1.15rem, 2vw, 1.5rem);
|
|
2077
|
-
font-weight: 800;
|
|
2078
|
-
line-height: 1.15;
|
|
2079
|
-
margin: 0;
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
[part~='price'] {
|
|
2083
|
-
color: var(--wodira-color-accent, #c40072);
|
|
2084
|
-
font-size: 1.35rem;
|
|
2085
|
-
font-weight: 850;
|
|
2086
|
-
}
|
|
2087
|
-
|
|
2088
|
-
[part~='tier-list'] {
|
|
2089
|
-
display: grid;
|
|
2090
|
-
gap: 0.55rem;
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
[part~='tier-row'] {
|
|
2094
|
-
align-items: center;
|
|
2095
|
-
background: var(--wodira-color-muted, #f6f5f8);
|
|
2096
|
-
border: 1px solid transparent;
|
|
2097
|
-
border-radius: var(--wodira-radius-sm, 0.625rem);
|
|
2098
|
-
display: grid;
|
|
2099
|
-
gap: 0.35rem;
|
|
2100
|
-
padding: 0.7rem 0.8rem;
|
|
2101
|
-
}
|
|
2102
|
-
|
|
2103
|
-
[part~='tier-row'][part~='current'] {
|
|
2104
|
-
background: color-mix(
|
|
2105
|
-
in srgb,
|
|
2106
|
-
var(--wodira-color-accent, #c40072) 10%,
|
|
2107
|
-
var(--wodira-color-surface, #fff)
|
|
2108
|
-
);
|
|
2109
|
-
border-color: color-mix(in srgb, var(--wodira-color-accent, #c40072) 45%, transparent);
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
[part~='tier-heading'] {
|
|
2113
|
-
align-items: center;
|
|
2114
|
-
display: flex;
|
|
2115
|
-
gap: 0.5rem;
|
|
2116
|
-
justify-content: space-between;
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
[part~='tier-name'] {
|
|
2120
|
-
font-weight: 800;
|
|
2121
|
-
}
|
|
2122
|
-
|
|
2123
|
-
[part~='tier-price'] {
|
|
2124
|
-
color: var(--wodira-color-accent, #c40072);
|
|
2125
|
-
font-weight: 850;
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
[part~='badge'] {
|
|
2129
|
-
background: var(--wodira-color-accent, #c40072);
|
|
2130
|
-
border-radius: 999px;
|
|
2131
|
-
color: var(--wodira-color-accent-contrast, #fff);
|
|
2132
|
-
display: inline-flex;
|
|
2133
|
-
font-size: 0.72rem;
|
|
2134
|
-
font-weight: 800;
|
|
2135
|
-
letter-spacing: 0.02em;
|
|
2136
|
-
padding: 0.2rem 0.5rem;
|
|
2137
|
-
text-transform: uppercase;
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
|
-
[part~='image'] {
|
|
2141
|
-
aspect-ratio: 16 / 9;
|
|
2142
|
-
border-radius: calc(var(--wodira-radius, 1rem) * 0.75);
|
|
2143
|
-
display: block;
|
|
2144
|
-
margin-block-end: var(--wodira-space, 1rem);
|
|
2145
|
-
object-fit: cover;
|
|
2146
|
-
width: 100%;
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
[part~='summary-row'] {
|
|
2150
|
-
display: flex;
|
|
2151
|
-
justify-content: space-between;
|
|
2152
|
-
gap: var(--wodira-space, 1rem);
|
|
2153
|
-
}
|
|
2154
|
-
`;
|
|
2155
|
-
|
|
2156
|
-
// src/ui/shirt-sponsors/shirt-auction.ts
|
|
2157
|
-
var copy = {
|
|
2158
|
-
es: {
|
|
2159
|
-
label: "Patrocina la camiseta del evento",
|
|
2160
|
-
loading: "Cargando camiseta y pujas…",
|
|
2161
|
-
error: "No se ha podido cargar la campaña.",
|
|
2162
|
-
invalid: "Configura una campaña y una clave publicable válidas.",
|
|
2163
|
-
retry: "Reintentar",
|
|
2164
|
-
shirtAria: "Camiseta 3D. Arrástrala para girarla y toca un espacio para elegirlo.",
|
|
2165
|
-
hint: "Arrastra para girar · Toca un espacio para pujar",
|
|
2166
|
-
noModel: "La vista 3D no está disponible en este dispositivo. Elige un espacio en la lista.",
|
|
2167
|
-
zoomIn: "Acercar camiseta",
|
|
2168
|
-
zoomOut: "Alejar camiseta",
|
|
2169
|
-
views: "Vista de la camiseta",
|
|
2170
|
-
slots: "Espacios",
|
|
2171
|
-
closes: "Cierre de pujas",
|
|
2172
|
-
shirts: "camisetas",
|
|
2173
|
-
from: "Desde",
|
|
2174
|
-
current: "Puja actual",
|
|
2175
|
-
reserved: "Reservado por la organización",
|
|
2176
|
-
minimum: "Puja mínima",
|
|
2177
|
-
increments: "Incrementos de",
|
|
2178
|
-
amount: "Tu puja (€)",
|
|
2179
|
-
bid: "Pujar",
|
|
2180
|
-
outbid: "Superar la puja",
|
|
2181
|
-
closed: "Las pujas de esta camiseta están cerradas.",
|
|
2182
|
-
pick: "Elige un espacio en la camiseta o en la lista.",
|
|
2183
|
-
belowMinimum: "La puja debe ser de al menos",
|
|
2184
|
-
step: "Usa múltiplos del incremento a partir de la puja mínima.",
|
|
2185
|
-
note: "Terminarás en WODira: inicio de sesión, logotipo en SVG y pago seguro con Stripe.",
|
|
2186
|
-
popupBlocked: "Tu navegador ha bloqueado la ventana de WODira.",
|
|
2187
|
-
openBid: "Abrir la puja en WODira",
|
|
2188
|
-
waiting: "Completa la puja en la ventana de WODira. Esta camiseta se actualizará sola.",
|
|
2189
|
-
paid: "Puja confirmada. Tu marca ya aparece en la camiseta.",
|
|
2190
|
-
leads: "lidera",
|
|
2191
|
-
sides: {
|
|
2192
|
-
front: "Delantera",
|
|
2193
|
-
back: "Trasera",
|
|
2194
|
-
"left-sleeve": "Manga izquierda",
|
|
2195
|
-
"right-sleeve": "Manga derecha"
|
|
2196
|
-
}
|
|
2197
|
-
},
|
|
2198
|
-
en: {
|
|
2199
|
-
label: "Sponsor the event shirt",
|
|
2200
|
-
loading: "Loading shirt and bids…",
|
|
2201
|
-
error: "The campaign could not be loaded.",
|
|
2202
|
-
invalid: "Set a valid campaign and publishable key.",
|
|
2203
|
-
retry: "Retry",
|
|
2204
|
-
shirtAria: "3D shirt. Drag it to turn it and tap a space to choose it.",
|
|
2205
|
-
hint: "Drag to turn · Tap a space to bid",
|
|
2206
|
-
noModel: "The 3D view is not available on this device. Choose a space from the list.",
|
|
2207
|
-
zoomIn: "Zoom in",
|
|
2208
|
-
zoomOut: "Zoom out",
|
|
2209
|
-
views: "Shirt view",
|
|
2210
|
-
slots: "Spaces",
|
|
2211
|
-
closes: "Bidding closes",
|
|
2212
|
-
shirts: "shirts",
|
|
2213
|
-
from: "From",
|
|
2214
|
-
current: "Current bid",
|
|
2215
|
-
reserved: "Reserved by the organizer",
|
|
2216
|
-
minimum: "Minimum bid",
|
|
2217
|
-
increments: "Increments of",
|
|
2218
|
-
amount: "Your bid (€)",
|
|
2219
|
-
bid: "Bid",
|
|
2220
|
-
outbid: "Outbid",
|
|
2221
|
-
closed: "Bidding for this shirt is closed.",
|
|
2222
|
-
pick: "Choose a space on the shirt or in the list.",
|
|
2223
|
-
belowMinimum: "The bid must be at least",
|
|
2224
|
-
step: "Use multiples of the increment above the minimum bid.",
|
|
2225
|
-
note: "You will finish on WODira: sign-in, SVG logo and secure Stripe payment.",
|
|
2226
|
-
popupBlocked: "Your browser blocked the WODira window.",
|
|
2227
|
-
openBid: "Open the bid on WODira",
|
|
2228
|
-
waiting: "Complete the bid in the WODira window. This shirt will update by itself.",
|
|
2229
|
-
paid: "Bid confirmed. Your brand is now on the shirt.",
|
|
2230
|
-
leads: "leads",
|
|
2231
|
-
sides: {
|
|
2232
|
-
front: "Front",
|
|
2233
|
-
back: "Back",
|
|
2234
|
-
"left-sleeve": "Left sleeve",
|
|
2235
|
-
"right-sleeve": "Right sleeve"
|
|
2236
|
-
}
|
|
2237
|
-
},
|
|
2238
|
-
pt: {
|
|
2239
|
-
label: "Patrocina a camisola do evento",
|
|
2240
|
-
loading: "A carregar camisola e licitações…",
|
|
2241
|
-
error: "Não foi possível carregar a campanha.",
|
|
2242
|
-
invalid: "Configura uma campanha e uma chave publicável válidas.",
|
|
2243
|
-
retry: "Tentar novamente",
|
|
2244
|
-
shirtAria: "Camisola 3D. Arrasta-a para a rodar e toca num espaço para o escolher.",
|
|
2245
|
-
hint: "Arrasta para rodar · Toca num espaço para licitar",
|
|
2246
|
-
noModel: "A vista 3D não está disponível neste dispositivo. Escolhe um espaço na lista.",
|
|
2247
|
-
zoomIn: "Aproximar camisola",
|
|
2248
|
-
zoomOut: "Afastar camisola",
|
|
2249
|
-
views: "Vista da camisola",
|
|
2250
|
-
slots: "Espaços",
|
|
2251
|
-
closes: "Fim das licitações",
|
|
2252
|
-
shirts: "camisolas",
|
|
2253
|
-
from: "Desde",
|
|
2254
|
-
current: "Licitação atual",
|
|
2255
|
-
reserved: "Reservado pela organização",
|
|
2256
|
-
minimum: "Licitação mínima",
|
|
2257
|
-
increments: "Incrementos de",
|
|
2258
|
-
amount: "A tua licitação (€)",
|
|
2259
|
-
bid: "Licitar",
|
|
2260
|
-
outbid: "Superar a licitação",
|
|
2261
|
-
closed: "As licitações desta camisola estão fechadas.",
|
|
2262
|
-
pick: "Escolhe um espaço na camisola ou na lista.",
|
|
2263
|
-
belowMinimum: "A licitação deve ser de pelo menos",
|
|
2264
|
-
step: "Usa múltiplos do incremento a partir da licitação mínima.",
|
|
2265
|
-
note: "Vais terminar na WODira: início de sessão, logótipo em SVG e pagamento seguro com Stripe.",
|
|
2266
|
-
popupBlocked: "O teu navegador bloqueou a janela da WODira.",
|
|
2267
|
-
openBid: "Abrir a licitação na WODira",
|
|
2268
|
-
waiting: "Conclui a licitação na janela da WODira. Esta camisola atualiza-se sozinha.",
|
|
2269
|
-
paid: "Licitação confirmada. A tua marca já aparece na camisola.",
|
|
2270
|
-
leads: "lidera",
|
|
2271
|
-
sides: {
|
|
2272
|
-
front: "Frente",
|
|
2273
|
-
back: "Costas",
|
|
2274
|
-
"left-sleeve": "Manga esquerda",
|
|
2275
|
-
"right-sleeve": "Manga direita"
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
};
|
|
2279
|
-
var SIDE_ORDER = ["front", "back", "left-sleeve", "right-sleeve"];
|
|
2280
|
-
var DEFAULT_APP_URL = "https://wodira.app";
|
|
2281
|
-
var SHIRT_MODEL_PATH = "/images/sponsor-studio/white-shirt-realistic-v1.glb?v=7";
|
|
2282
|
-
var CLICK_TOLERANCE_PX = 6;
|
|
2283
|
-
var PALETTE_TOKENS = {
|
|
2284
|
-
slot: ["--wodira-color-accent", "#c40072"],
|
|
2285
|
-
slotPreview: ["--wodira-color-accent", "#c40072"],
|
|
2286
|
-
slotText: ["--wodira-color-accent-contrast", "#ffffff"],
|
|
2287
|
-
priceLeading: ["--wodira-color-accent", "#c40072"],
|
|
2288
|
-
price: ["--wodira-color-primary", "#17132e"],
|
|
2289
|
-
reserved: ["--wodira-color-border", "#dcd9e3"],
|
|
2290
|
-
selected: ["--wodira-color-primary", "#17132e"]
|
|
2291
|
-
};
|
|
2292
|
-
function placement(side) {
|
|
2293
|
-
return side === "left-sleeve" || side === "right-sleeve" ? { side: "front", surface: side } : { side };
|
|
2294
|
-
}
|
|
2295
|
-
function toSponsorSlot(slot) {
|
|
2296
|
-
const result = {
|
|
2297
|
-
id: slot.id,
|
|
2298
|
-
name: slot.name,
|
|
2299
|
-
...placement(slot.side),
|
|
2300
|
-
x: slot.x,
|
|
2301
|
-
y: slot.y,
|
|
2302
|
-
width: slot.width,
|
|
2303
|
-
height: slot.height,
|
|
2304
|
-
printWidth: slot.printWidthCm,
|
|
2305
|
-
printHeight: slot.printHeightCm,
|
|
2306
|
-
startingPrice: slot.startingPriceCents / 100,
|
|
2307
|
-
bidPrice: slot.minimumBidCents / 100,
|
|
2308
|
-
increment: slot.incrementCents / 100,
|
|
2309
|
-
isReserved: !!slot.isReserved,
|
|
2310
|
-
bids: slot.leadingArtworkUrl ? [
|
|
2311
|
-
{
|
|
2312
|
-
id: slot.id,
|
|
2313
|
-
buyer: slot.leadingBrandName ?? "",
|
|
2314
|
-
amount: (slot.leadingAmountCents ?? 0) / 100,
|
|
2315
|
-
paidAt: 0,
|
|
2316
|
-
status: "leading",
|
|
2317
|
-
logo: slot.leadingArtworkUrl,
|
|
2318
|
-
views: 0,
|
|
2319
|
-
opens: 0,
|
|
2320
|
-
clicks: 0
|
|
2321
|
-
}
|
|
2322
|
-
] : []
|
|
2323
|
-
};
|
|
2324
|
-
if (slot.reservedArtworkUrl)
|
|
2325
|
-
result.reservedLogo = slot.reservedArtworkUrl;
|
|
2326
|
-
return result;
|
|
2327
|
-
}
|
|
2328
|
-
function safeHttpUrl(value) {
|
|
2329
|
-
try {
|
|
2330
|
-
const url = new URL(value);
|
|
2331
|
-
const local = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
|
|
2332
|
-
if (url.username || url.password)
|
|
2333
|
-
return null;
|
|
2334
|
-
return url.protocol === "https:" || local && url.protocol === "http:" ? url : null;
|
|
2335
|
-
} catch {
|
|
2336
|
-
return null;
|
|
2337
|
-
}
|
|
2338
|
-
}
|
|
2339
|
-
|
|
2340
|
-
class WodiraShirtAuction2 extends LitElement {
|
|
2341
|
-
static properties = {
|
|
2342
|
-
campaignId: { type: String, attribute: "campaign-id" },
|
|
2343
|
-
publishableKey: { type: String, attribute: "publishable-key" },
|
|
2344
|
-
baseUrl: { type: String, attribute: "base-url" },
|
|
2345
|
-
appUrl: { type: String, attribute: "app-url" },
|
|
2346
|
-
locale: { type: String },
|
|
2347
|
-
campaign: { state: true },
|
|
2348
|
-
loading: { state: true },
|
|
2349
|
-
failed: { state: true },
|
|
2350
|
-
selectedSlotId: { state: true },
|
|
2351
|
-
side: { state: true },
|
|
2352
|
-
amountEuros: { state: true },
|
|
2353
|
-
modelUnavailable: { state: true },
|
|
2354
|
-
modelLoading: { state: true },
|
|
2355
|
-
status: { state: true }
|
|
2356
|
-
};
|
|
2357
|
-
static styles = [
|
|
2358
|
-
wodiraUiStyles,
|
|
2359
|
-
css`
|
|
2360
|
-
:host {
|
|
2361
|
-
/* Earlier releases used these shorter names; they still apply as fallbacks. */
|
|
2362
|
-
--_accent: var(--wodira-color-accent, var(--wodira-primary, #c40072));
|
|
2363
|
-
--_accent-contrast: var(--wodira-color-accent-contrast, #fff);
|
|
2364
|
-
--_surface: var(--wodira-color-surface, var(--wodira-background, #fff));
|
|
2365
|
-
--_muted: var(--wodira-color-muted, #f6f5f8);
|
|
2366
|
-
--_border: var(--wodira-color-border, var(--wodira-border, #dcd9e3));
|
|
2367
|
-
--_text: var(--wodira-color-text, var(--wodira-text, #17132e));
|
|
2368
|
-
--_text-muted: var(--wodira-color-text-muted, #625e70);
|
|
2369
|
-
--_radius: var(--wodira-radius, 1rem);
|
|
2370
|
-
--_radius-sm: var(--wodira-radius-sm, 0.625rem);
|
|
2371
|
-
--_space: var(--wodira-space, 1rem);
|
|
2372
|
-
color: var(--_text);
|
|
2373
|
-
}
|
|
2374
|
-
|
|
2375
|
-
[part~='container'] {
|
|
2376
|
-
background: var(--_surface);
|
|
2377
|
-
border: 1px solid var(--_border);
|
|
2378
|
-
border-radius: var(--_radius);
|
|
2379
|
-
box-shadow: var(--wodira-shadow, none);
|
|
2380
|
-
display: grid;
|
|
2381
|
-
gap: var(--_space);
|
|
2382
|
-
padding: var(--wodira-card-padding, clamp(1rem, 3cqi, 1.75rem));
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
[part~='header'] {
|
|
2386
|
-
display: grid;
|
|
2387
|
-
gap: 0.35rem;
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
[part~='title'] {
|
|
2391
|
-
font-size: clamp(1.25rem, 4cqi, 1.75rem);
|
|
2392
|
-
line-height: 1.15;
|
|
2393
|
-
margin: 0;
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
[part~='meta'] {
|
|
2397
|
-
color: var(--_text-muted);
|
|
2398
|
-
display: flex;
|
|
2399
|
-
flex-wrap: wrap;
|
|
2400
|
-
font-size: 0.875rem;
|
|
2401
|
-
gap: 0.25rem 1rem;
|
|
2402
|
-
margin: 0;
|
|
2403
|
-
}
|
|
2404
|
-
|
|
2405
|
-
[part~='layout'] {
|
|
2406
|
-
display: grid;
|
|
2407
|
-
gap: var(--_space);
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
@container (min-width: 46rem) {
|
|
2411
|
-
[part~='layout'] {
|
|
2412
|
-
align-items: start;
|
|
2413
|
-
grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2417
|
-
[part~='stage'] {
|
|
2418
|
-
aspect-ratio: 1 / 1;
|
|
2419
|
-
background: var(--wodira-shirt-stage-background, var(--_muted));
|
|
2420
|
-
border-radius: var(--_radius);
|
|
2421
|
-
max-height: min(36rem, 75vh);
|
|
2422
|
-
overflow: hidden;
|
|
2423
|
-
position: relative;
|
|
2424
|
-
width: 100%;
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
[part~='shirt'] {
|
|
2428
|
-
cursor: grab;
|
|
2429
|
-
display: block;
|
|
2430
|
-
height: 100%;
|
|
2431
|
-
/* Vertical swipes keep scrolling the page; horizontal drags turn the shirt. */
|
|
2432
|
-
touch-action: pan-y;
|
|
2433
|
-
width: 100%;
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
[part~='shirt']:active {
|
|
2437
|
-
cursor: grabbing;
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
|
-
[part~='shirt']:focus-visible {
|
|
2441
|
-
outline: 3px solid var(--_accent);
|
|
2442
|
-
outline-offset: -3px;
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
[part~='stage-hint'] {
|
|
2446
|
-
background: color-mix(in srgb, var(--_surface) 88%, transparent);
|
|
2447
|
-
border-radius: 999px;
|
|
2448
|
-
bottom: 0.75rem;
|
|
2449
|
-
color: var(--_text-muted);
|
|
2450
|
-
font-size: 0.8125rem;
|
|
2451
|
-
left: 0.75rem;
|
|
2452
|
-
margin: 0;
|
|
2453
|
-
padding: 0.35rem 0.75rem;
|
|
2454
|
-
pointer-events: none;
|
|
2455
|
-
position: absolute;
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
[part~='stage-controls'] {
|
|
2459
|
-
display: flex;
|
|
2460
|
-
gap: 0.5rem;
|
|
2461
|
-
position: absolute;
|
|
2462
|
-
right: 0.75rem;
|
|
2463
|
-
top: 0.75rem;
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
[part~='zoom-button'],
|
|
2467
|
-
[part~='side-button'] {
|
|
2468
|
-
align-items: center;
|
|
2469
|
-
background: var(--_surface);
|
|
2470
|
-
border: 1px solid var(--_border);
|
|
2471
|
-
border-radius: var(--_radius-sm);
|
|
2472
|
-
color: var(--_text);
|
|
2473
|
-
cursor: pointer;
|
|
2474
|
-
display: inline-flex;
|
|
2475
|
-
font: inherit;
|
|
2476
|
-
justify-content: center;
|
|
2477
|
-
min-height: 2.75rem;
|
|
2478
|
-
min-width: 2.75rem;
|
|
2479
|
-
padding: 0 0.75rem;
|
|
2480
|
-
transition:
|
|
2481
|
-
background-color 0.15s ease,
|
|
2482
|
-
border-color 0.15s ease;
|
|
2483
|
-
}
|
|
2484
|
-
|
|
2485
|
-
[part~='side-button'][aria-pressed='true'] {
|
|
2486
|
-
background: var(--_accent);
|
|
2487
|
-
border-color: var(--_accent);
|
|
2488
|
-
color: var(--_accent-contrast);
|
|
2489
|
-
}
|
|
2490
|
-
|
|
2491
|
-
[part~='side-switch'] {
|
|
2492
|
-
display: flex;
|
|
2493
|
-
flex-wrap: wrap;
|
|
2494
|
-
gap: 0.5rem;
|
|
2495
|
-
}
|
|
2496
|
-
|
|
2497
|
-
[part~='stage-fallback'] {
|
|
2498
|
-
align-items: center;
|
|
2499
|
-
color: var(--_text-muted);
|
|
2500
|
-
display: flex;
|
|
2501
|
-
height: 100%;
|
|
2502
|
-
justify-content: center;
|
|
2503
|
-
margin: 0;
|
|
2504
|
-
padding: 1.5rem;
|
|
2505
|
-
text-align: center;
|
|
2506
|
-
}
|
|
2507
|
-
|
|
2508
|
-
[part~='slot-list'] {
|
|
2509
|
-
display: grid;
|
|
2510
|
-
gap: 0.5rem;
|
|
2511
|
-
list-style: none;
|
|
2512
|
-
margin: 0;
|
|
2513
|
-
padding: 0;
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
[part~='slot'] {
|
|
2517
|
-
align-items: center;
|
|
2518
|
-
background: var(--_surface);
|
|
2519
|
-
border: 1px solid var(--_border);
|
|
2520
|
-
border-radius: var(--_radius-sm);
|
|
2521
|
-
color: inherit;
|
|
2522
|
-
cursor: pointer;
|
|
2523
|
-
display: grid;
|
|
2524
|
-
font: inherit;
|
|
2525
|
-
gap: 0.15rem 1rem;
|
|
2526
|
-
grid-template-columns: minmax(0, 1fr) auto;
|
|
2527
|
-
min-height: 3.25rem;
|
|
2528
|
-
padding: 0.75rem 1rem;
|
|
2529
|
-
text-align: start;
|
|
2530
|
-
transition:
|
|
2531
|
-
background-color 0.15s ease,
|
|
2532
|
-
border-color 0.15s ease;
|
|
2533
|
-
width: 100%;
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
|
-
[part~='slot-selected'] {
|
|
2537
|
-
background: color-mix(in srgb, var(--_accent) 8%, var(--_surface));
|
|
2538
|
-
border-color: var(--_accent);
|
|
2539
|
-
box-shadow: inset 4px 0 0 var(--_accent);
|
|
2540
|
-
}
|
|
2541
|
-
|
|
2542
|
-
[part~='slot']:disabled {
|
|
2543
|
-
cursor: default;
|
|
2544
|
-
opacity: 0.7;
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
[part~='slot']:focus-visible,
|
|
2548
|
-
[part~='zoom-button']:focus-visible,
|
|
2549
|
-
[part~='side-button']:focus-visible {
|
|
2550
|
-
outline: 3px solid var(--_accent);
|
|
2551
|
-
outline-offset: 2px;
|
|
2552
|
-
}
|
|
2553
|
-
|
|
2554
|
-
@media (hover: hover) {
|
|
2555
|
-
[part~='slot']:not(:disabled):hover,
|
|
2556
|
-
[part~='zoom-button']:hover,
|
|
2557
|
-
[part~='side-button']:hover {
|
|
2558
|
-
border-color: var(--_accent);
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
[part~='slot-name'] {
|
|
2563
|
-
font-weight: 700;
|
|
2564
|
-
}
|
|
2565
|
-
|
|
2566
|
-
[part~='slot-detail'] {
|
|
2567
|
-
color: var(--_text-muted);
|
|
2568
|
-
font-size: 0.8125rem;
|
|
2569
|
-
grid-column: 1;
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
[part~='slot-price'] {
|
|
2573
|
-
font-variant-numeric: tabular-nums;
|
|
2574
|
-
font-weight: 700;
|
|
2575
|
-
grid-column: 2;
|
|
2576
|
-
grid-row: 1 / span 2;
|
|
2577
|
-
text-align: end;
|
|
2578
|
-
white-space: nowrap;
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
[part~='slot-price'] small {
|
|
2582
|
-
color: var(--_text-muted);
|
|
2583
|
-
display: block;
|
|
2584
|
-
font-size: 0.75rem;
|
|
2585
|
-
font-weight: 500;
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
[part~='section-title'] {
|
|
2589
|
-
font-size: 0.8125rem;
|
|
2590
|
-
letter-spacing: 0.08em;
|
|
2591
|
-
margin: 0;
|
|
2592
|
-
text-transform: uppercase;
|
|
2593
|
-
}
|
|
2594
|
-
|
|
2595
|
-
[part~='bid-panel'] {
|
|
2596
|
-
background: var(--_muted);
|
|
2597
|
-
border-radius: var(--_radius);
|
|
2598
|
-
display: grid;
|
|
2599
|
-
gap: 0.75rem;
|
|
2600
|
-
padding: var(--_space);
|
|
2601
|
-
}
|
|
2602
|
-
|
|
2603
|
-
[part~='bid-title'] {
|
|
2604
|
-
font-size: 1.125rem;
|
|
2605
|
-
margin: 0;
|
|
2606
|
-
}
|
|
2607
|
-
|
|
2608
|
-
[part~='leader'] {
|
|
2609
|
-
align-items: center;
|
|
2610
|
-
display: flex;
|
|
2611
|
-
gap: 0.75rem;
|
|
2612
|
-
margin: 0;
|
|
2613
|
-
}
|
|
2614
|
-
|
|
2615
|
-
[part~='leader-logo'] {
|
|
2616
|
-
background: #fff;
|
|
2617
|
-
border-radius: 0.5rem;
|
|
2618
|
-
height: 2.5rem;
|
|
2619
|
-
object-fit: contain;
|
|
2620
|
-
outline: 1px solid rgb(0 0 0 / 0.1);
|
|
2621
|
-
outline-offset: -1px;
|
|
2622
|
-
padding: 0.25rem;
|
|
2623
|
-
width: 4.5rem;
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
|
-
[part~='bid-form'] {
|
|
2627
|
-
display: grid;
|
|
2628
|
-
gap: 0.75rem;
|
|
2629
|
-
}
|
|
2630
|
-
|
|
2631
|
-
[part~='bid-form'] [part~='label'] {
|
|
2632
|
-
display: grid;
|
|
2633
|
-
gap: 0.35rem;
|
|
2634
|
-
}
|
|
2635
|
-
|
|
2636
|
-
[part~='status'] {
|
|
2637
|
-
margin: 0;
|
|
2638
|
-
}
|
|
2639
|
-
|
|
2640
|
-
@media (prefers-reduced-motion: reduce) {
|
|
2641
|
-
[part~='slot'],
|
|
2642
|
-
[part~='zoom-button'],
|
|
2643
|
-
[part~='side-button'] {
|
|
2644
|
-
transition: none;
|
|
2645
|
-
}
|
|
2646
|
-
}
|
|
2647
|
-
`
|
|
2648
|
-
];
|
|
2649
|
-
client = null;
|
|
2650
|
-
abort = null;
|
|
2651
|
-
renderer = null;
|
|
2652
|
-
rendererCanvas = null;
|
|
2653
|
-
rendererGeneration = 0;
|
|
2654
|
-
canvasRevision = 0;
|
|
2655
|
-
drag = null;
|
|
2656
|
-
bidWindow = null;
|
|
2657
|
-
bidWindowTimer;
|
|
2658
|
-
blockedUrl = "";
|
|
2659
|
-
channel = globalThis.crypto.randomUUID();
|
|
2660
|
-
themeObserver = null;
|
|
2661
|
-
colorScheme = null;
|
|
2662
|
-
constructor() {
|
|
2663
|
-
super();
|
|
2664
|
-
this.campaignId = "";
|
|
2665
|
-
this.publishableKey = "";
|
|
2666
|
-
this.baseUrl = "";
|
|
2667
|
-
this.appUrl = DEFAULT_APP_URL;
|
|
2668
|
-
this.locale = "auto";
|
|
2669
|
-
this.campaign = null;
|
|
2670
|
-
this.loading = false;
|
|
2671
|
-
this.failed = false;
|
|
2672
|
-
this.selectedSlotId = null;
|
|
2673
|
-
this.side = "front";
|
|
2674
|
-
this.amountEuros = null;
|
|
2675
|
-
this.modelUnavailable = false;
|
|
2676
|
-
this.modelLoading = true;
|
|
2677
|
-
this.status = "idle";
|
|
2678
|
-
}
|
|
2679
|
-
refreshTheme() {
|
|
2680
|
-
this.renderer?.setAppearance({ palette: this.palette(), locale: this.numberLocale });
|
|
2681
|
-
}
|
|
2682
|
-
connectedCallback() {
|
|
2683
|
-
super.connectedCallback();
|
|
2684
|
-
window.addEventListener("message", this.onMessage);
|
|
2685
|
-
window.addEventListener("focus", this.onWindowFocus);
|
|
2686
|
-
this.themeObserver = new MutationObserver(() => this.refreshTheme());
|
|
2687
|
-
for (const target of [this, this.ownerDocument.documentElement, this.ownerDocument.body])
|
|
2688
|
-
if (target)
|
|
2689
|
-
this.themeObserver.observe(target, {
|
|
2690
|
-
attributes: true,
|
|
2691
|
-
attributeFilter: ["class", "style", "data-theme"]
|
|
2692
|
-
});
|
|
2693
|
-
this.colorScheme = matchMedia("(prefers-color-scheme: dark)");
|
|
2694
|
-
this.colorScheme.addEventListener("change", this.onColorScheme);
|
|
2695
|
-
if (this.hasUpdated) {
|
|
2696
|
-
this.modelUnavailable = false;
|
|
2697
|
-
this.requestUpdate();
|
|
2698
|
-
this.load(true);
|
|
2699
|
-
this.watchBidWindow();
|
|
2700
|
-
}
|
|
2701
|
-
}
|
|
2702
|
-
disconnectedCallback() {
|
|
2703
|
-
window.removeEventListener("message", this.onMessage);
|
|
2704
|
-
window.removeEventListener("focus", this.onWindowFocus);
|
|
2705
|
-
this.themeObserver?.disconnect();
|
|
2706
|
-
this.colorScheme?.removeEventListener("change", this.onColorScheme);
|
|
2707
|
-
clearInterval(this.bidWindowTimer);
|
|
2708
|
-
this.abort?.abort();
|
|
2709
|
-
this.disposeRenderer();
|
|
2710
|
-
this.canvasRevision++;
|
|
2711
|
-
super.disconnectedCallback();
|
|
2712
|
-
}
|
|
2713
|
-
willUpdate(changes) {
|
|
2714
|
-
if (changes.has("campaignId") || changes.has("publishableKey") || changes.has("baseUrl") || changes.has("appUrl")) {
|
|
2715
|
-
this.client = this.createClient();
|
|
2716
|
-
clearInterval(this.bidWindowTimer);
|
|
2717
|
-
this.bidWindow = null;
|
|
2718
|
-
this.blockedUrl = "";
|
|
2719
|
-
this.canvasRevision++;
|
|
2720
|
-
this.selectedSlotId = null;
|
|
2721
|
-
this.status = "idle";
|
|
2722
|
-
this.modelUnavailable = false;
|
|
2723
|
-
this.disposeRenderer();
|
|
2724
|
-
this.load();
|
|
2725
|
-
}
|
|
2726
|
-
}
|
|
2727
|
-
updated(changes) {
|
|
2728
|
-
const canvas = this.renderRoot.querySelector("canvas");
|
|
2729
|
-
if (canvas !== this.rendererCanvas) {
|
|
2730
|
-
this.disposeRenderer();
|
|
2731
|
-
if (canvas)
|
|
2732
|
-
this.startRenderer(canvas);
|
|
2733
|
-
} else if (changes.has("campaign") || changes.has("side") || changes.has("selectedSlotId"))
|
|
2734
|
-
this.paintShirt();
|
|
2735
|
-
if (changes.has("locale"))
|
|
2736
|
-
this.refreshTheme();
|
|
2737
|
-
}
|
|
2738
|
-
get language() {
|
|
2739
|
-
const locale = this.locale && this.locale !== "auto" ? this.locale : this.ownerDocument.documentElement.lang || navigator.language || "es";
|
|
2740
|
-
const language = locale.toLowerCase().split("-")[0];
|
|
2741
|
-
return language === "en" || language === "pt" ? language : "es";
|
|
2742
|
-
}
|
|
2743
|
-
get numberLocale() {
|
|
2744
|
-
return this.locale && this.locale !== "auto" ? this.locale : this.ownerDocument.documentElement.lang || navigator.language || "es-ES";
|
|
2745
|
-
}
|
|
2746
|
-
get text() {
|
|
2747
|
-
return copy[this.language];
|
|
2748
|
-
}
|
|
2749
|
-
get appOrigin() {
|
|
2750
|
-
return safeHttpUrl(this.appUrl || DEFAULT_APP_URL);
|
|
2751
|
-
}
|
|
2752
|
-
createClient() {
|
|
2753
|
-
if (!/^[a-zA-Z0-9_-]{1,160}$/.test(this.campaignId))
|
|
2754
|
-
return null;
|
|
2755
|
-
if (!this.publishableKey?.startsWith("wpk_live_"))
|
|
2756
|
-
return null;
|
|
2757
|
-
if (!this.appOrigin)
|
|
2758
|
-
return null;
|
|
2759
|
-
const options = { publishableKey: this.publishableKey };
|
|
2760
|
-
if (this.baseUrl) {
|
|
2761
|
-
if (!safeHttpUrl(this.baseUrl))
|
|
2762
|
-
return null;
|
|
2763
|
-
options.baseUrl = this.baseUrl;
|
|
2764
|
-
}
|
|
2765
|
-
try {
|
|
2766
|
-
return createWodiraBrowserClient(options);
|
|
2767
|
-
} catch {
|
|
2768
|
-
return null;
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
async load(silent = false) {
|
|
2772
|
-
this.abort?.abort();
|
|
2773
|
-
if (!this.client) {
|
|
2774
|
-
this.campaign = null;
|
|
2775
|
-
this.loading = false;
|
|
2776
|
-
return;
|
|
2777
|
-
}
|
|
2778
|
-
const abort = new AbortController;
|
|
2779
|
-
this.abort = abort;
|
|
2780
|
-
if (!silent)
|
|
2781
|
-
this.loading = true;
|
|
2782
|
-
this.failed = false;
|
|
2783
|
-
try {
|
|
2784
|
-
const campaign = await this.client.getShirtSponsorCampaign(this.campaignId, abort.signal);
|
|
2785
|
-
if (abort.signal.aborted)
|
|
2786
|
-
return;
|
|
2787
|
-
this.campaign = campaign;
|
|
2788
|
-
const current = campaign.slots.find((slot) => slot.id === this.selectedSlotId);
|
|
2789
|
-
const next = current ?? campaign.slots.find((slot) => !slot.isReserved && slot.side === "front") ?? campaign.slots.find((slot) => !slot.isReserved) ?? campaign.slots[0];
|
|
2790
|
-
if (next)
|
|
2791
|
-
this.select(next, false);
|
|
2792
|
-
} catch {
|
|
2793
|
-
if (abort.signal.aborted)
|
|
2794
|
-
return;
|
|
2795
|
-
if (!silent)
|
|
2796
|
-
this.failed = true;
|
|
2797
|
-
} finally {
|
|
2798
|
-
if (!abort.signal.aborted)
|
|
2799
|
-
this.loading = false;
|
|
2800
|
-
}
|
|
2801
|
-
}
|
|
2802
|
-
get biddingOpen() {
|
|
2803
|
-
const campaign = this.campaign;
|
|
2804
|
-
return !!campaign && campaign.status === "PUBLISHED" && new Date(campaign.closesAt) > new Date;
|
|
2805
|
-
}
|
|
2806
|
-
get selectedSlot() {
|
|
2807
|
-
return this.campaign?.slots.find((slot) => slot.id === this.selectedSlotId) ?? null;
|
|
2808
|
-
}
|
|
2809
|
-
get orderedSlots() {
|
|
2810
|
-
return [...this.campaign?.slots ?? []].sort((a, b) => SIDE_ORDER.indexOf(a.side) - SIDE_ORDER.indexOf(b.side));
|
|
2811
|
-
}
|
|
2812
|
-
get sides() {
|
|
2813
|
-
const used = new Set(this.campaign?.slots.map((slot) => slot.side));
|
|
2814
|
-
return SIDE_ORDER.filter((side) => side === "front" || side === "back" || used.has(side));
|
|
2815
|
-
}
|
|
2816
|
-
select(slot, announce = true) {
|
|
2817
|
-
const changed = slot.id !== this.selectedSlotId;
|
|
2818
|
-
this.selectedSlotId = slot.id;
|
|
2819
|
-
if (changed)
|
|
2820
|
-
this.side = slot.side;
|
|
2821
|
-
if (changed || this.amountEuros === null || this.amountEuros * 100 < slot.minimumBidCents)
|
|
2822
|
-
this.amountEuros = slot.minimumBidCents / 100;
|
|
2823
|
-
if (announce && changed)
|
|
2824
|
-
this.dispatchEvent(new CustomEvent("wodira:shirt:slot-selected", {
|
|
2825
|
-
bubbles: true,
|
|
2826
|
-
composed: true,
|
|
2827
|
-
detail: { campaignId: this.campaignId, slotId: slot.id }
|
|
2828
|
-
}));
|
|
2829
|
-
}
|
|
2830
|
-
formatMoney(cents) {
|
|
2831
|
-
const digits = cents % 100 ? 2 : 0;
|
|
2832
|
-
try {
|
|
2833
|
-
return new Intl.NumberFormat(this.numberLocale, {
|
|
2834
|
-
style: "currency",
|
|
2835
|
-
currency: "EUR",
|
|
2836
|
-
minimumFractionDigits: digits,
|
|
2837
|
-
maximumFractionDigits: digits
|
|
2838
|
-
}).format(cents / 100);
|
|
2839
|
-
} catch {
|
|
2840
|
-
return `${(cents / 100).toFixed(digits)} €`;
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
formatDate(value) {
|
|
2844
|
-
try {
|
|
2845
|
-
return new Intl.DateTimeFormat(this.numberLocale, {
|
|
2846
|
-
dateStyle: "medium",
|
|
2847
|
-
timeStyle: "short"
|
|
2848
|
-
}).format(new Date(value));
|
|
2849
|
-
} catch {
|
|
2850
|
-
return value;
|
|
2851
|
-
}
|
|
2852
|
-
}
|
|
2853
|
-
palette() {
|
|
2854
|
-
const style = getComputedStyle(this);
|
|
2855
|
-
const palette = {};
|
|
2856
|
-
for (const [key, [token, fallback]] of Object.entries(PALETTE_TOKENS))
|
|
2857
|
-
palette[key] = style.getPropertyValue(token).trim() || fallback;
|
|
2858
|
-
return palette;
|
|
2859
|
-
}
|
|
2860
|
-
async startRenderer(canvas) {
|
|
2861
|
-
const generation = ++this.rendererGeneration;
|
|
2862
|
-
this.rendererCanvas = canvas;
|
|
2863
|
-
this.modelLoading = true;
|
|
2864
|
-
try {
|
|
2865
|
-
const { Shirt3dRenderer } = await (__preload("jyks1h8f"), import("./shirt-3d-renderer-jyks1h8f.js"));
|
|
2866
|
-
if (generation !== this.rendererGeneration)
|
|
2867
|
-
return;
|
|
2868
|
-
const renderer = new Shirt3dRenderer(canvas, () => {
|
|
2869
|
-
if (generation === this.rendererGeneration)
|
|
2870
|
-
this.modelUnavailable = true;
|
|
2871
|
-
}, (loading) => {
|
|
2872
|
-
if (generation === this.rendererGeneration)
|
|
2873
|
-
this.modelLoading = loading;
|
|
2874
|
-
}, {
|
|
2875
|
-
modelUrl: new URL(SHIRT_MODEL_PATH, this.appOrigin ?? DEFAULT_APP_URL).href,
|
|
2876
|
-
locale: this.numberLocale,
|
|
2877
|
-
palette: this.palette()
|
|
2878
|
-
});
|
|
2879
|
-
this.renderer = renderer;
|
|
2880
|
-
this.paintShirt();
|
|
2881
|
-
await renderer.load();
|
|
2882
|
-
if (generation === this.rendererGeneration)
|
|
2883
|
-
this.modelLoading = false;
|
|
2884
|
-
} catch {
|
|
2885
|
-
if (generation === this.rendererGeneration) {
|
|
2886
|
-
this.disposeRenderer();
|
|
2887
|
-
this.modelUnavailable = true;
|
|
2888
|
-
}
|
|
2889
|
-
}
|
|
2890
|
-
}
|
|
2891
|
-
disposeRenderer() {
|
|
2892
|
-
this.rendererGeneration++;
|
|
2893
|
-
this.renderer?.dispose();
|
|
2894
|
-
this.renderer = null;
|
|
2895
|
-
this.rendererCanvas = null;
|
|
2896
|
-
this.drag = null;
|
|
2897
|
-
}
|
|
2898
|
-
paintShirt() {
|
|
2899
|
-
const campaign = this.campaign;
|
|
2900
|
-
if (!this.renderer || !campaign)
|
|
2901
|
-
return;
|
|
2902
|
-
const view = placement(this.side);
|
|
2903
|
-
const design = campaign.shirtDesign;
|
|
2904
|
-
const artwork = design ? {
|
|
2905
|
-
...design.front ? { front: design.front } : {},
|
|
2906
|
-
...design.back ? { back: design.back } : {}
|
|
2907
|
-
} : null;
|
|
2908
|
-
this.renderer.setSelectedSlot(this.selectedSlotId);
|
|
2909
|
-
this.renderer.update(campaign.slots.map(toSponsorSlot), view.side, true, campaign.shirtColor || "#ffffff", false, artwork, view.surface);
|
|
2910
|
-
}
|
|
2911
|
-
onPointerDown(event) {
|
|
2912
|
-
if (event.button !== 0)
|
|
2913
|
-
return;
|
|
2914
|
-
this.drag = {
|
|
2915
|
-
id: event.pointerId,
|
|
2916
|
-
x: event.clientX,
|
|
2917
|
-
y: event.clientY,
|
|
2918
|
-
originX: event.clientX,
|
|
2919
|
-
originY: event.clientY
|
|
2920
|
-
};
|
|
2921
|
-
if (event.pointerType !== "touch")
|
|
2922
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
2923
|
-
}
|
|
2924
|
-
onPointerMove(event) {
|
|
2925
|
-
const drag = this.drag;
|
|
2926
|
-
if (!drag || drag.id !== event.pointerId)
|
|
2927
|
-
return;
|
|
2928
|
-
const distance = Math.hypot(event.clientX - drag.originX, event.clientY - drag.originY);
|
|
2929
|
-
if (distance <= CLICK_TOLERANCE_PX)
|
|
2930
|
-
return;
|
|
2931
|
-
this.renderer?.rotate(event.clientX - drag.x, event.clientY - drag.y);
|
|
2932
|
-
drag.x = event.clientX;
|
|
2933
|
-
drag.y = event.clientY;
|
|
2934
|
-
}
|
|
2935
|
-
onPointerUp(event) {
|
|
2936
|
-
const drag = this.drag;
|
|
2937
|
-
this.drag = null;
|
|
2938
|
-
if (!drag || drag.id !== event.pointerId)
|
|
2939
|
-
return;
|
|
2940
|
-
const distance = Math.hypot(event.clientX - drag.originX, event.clientY - drag.originY);
|
|
2941
|
-
if (distance > CLICK_TOLERANCE_PX)
|
|
2942
|
-
return;
|
|
2943
|
-
const picked = this.renderer?.pick(event.clientX, event.clientY);
|
|
2944
|
-
const slot = picked && this.campaign?.slots.find((item) => item.id === picked.id);
|
|
2945
|
-
if (slot && !slot.isReserved)
|
|
2946
|
-
this.select(slot);
|
|
2947
|
-
}
|
|
2948
|
-
onPointerCancel() {
|
|
2949
|
-
this.drag = null;
|
|
2950
|
-
}
|
|
2951
|
-
onShirtKey(event) {
|
|
2952
|
-
if (!this.renderer)
|
|
2953
|
-
return;
|
|
2954
|
-
const turns = {
|
|
2955
|
-
ArrowLeft: [-10, 0],
|
|
2956
|
-
ArrowRight: [10, 0],
|
|
2957
|
-
ArrowUp: [0, -10],
|
|
2958
|
-
ArrowDown: [0, 10]
|
|
2959
|
-
};
|
|
2960
|
-
const turn = turns[event.key];
|
|
2961
|
-
if (turn) {
|
|
2962
|
-
event.preventDefault();
|
|
2963
|
-
this.renderer.rotate(turn[0], turn[1]);
|
|
2964
|
-
} else if (event.key === "+" || event.key === "=") {
|
|
2965
|
-
event.preventDefault();
|
|
2966
|
-
this.renderer.zoomBy(0.1);
|
|
2967
|
-
} else if (event.key === "-") {
|
|
2968
|
-
event.preventDefault();
|
|
2969
|
-
this.renderer.zoomBy(-0.1);
|
|
2970
|
-
}
|
|
2971
|
-
}
|
|
2972
|
-
showSide(side) {
|
|
2973
|
-
this.side = side;
|
|
2974
|
-
this.renderer?.resetView();
|
|
2975
|
-
this.paintShirt();
|
|
2976
|
-
}
|
|
2977
|
-
bidUrl(slot, amountCents) {
|
|
2978
|
-
const app = this.appOrigin;
|
|
2979
|
-
if (!app)
|
|
2980
|
-
return null;
|
|
2981
|
-
const local = ["localhost", "127.0.0.1", "[::1]"].includes(app.hostname);
|
|
2982
|
-
const path = `${local ? "" : `/${this.language}`}/patrocinios/camisetas/${encodeURIComponent(this.campaignId)}`;
|
|
2983
|
-
const url = new URL(path, app.origin);
|
|
2984
|
-
url.searchParams.set("slot", slot.id);
|
|
2985
|
-
url.searchParams.set("amount", String(amountCents));
|
|
2986
|
-
url.searchParams.set("channel", this.channel);
|
|
2987
|
-
url.searchParams.set("parentOrigin", location.origin);
|
|
2988
|
-
return url.href;
|
|
2989
|
-
}
|
|
2990
|
-
amountProblem(slot) {
|
|
2991
|
-
const cents = Math.round((this.amountEuros ?? 0) * 100);
|
|
2992
|
-
if (!Number.isFinite(cents) || cents < slot.minimumBidCents)
|
|
2993
|
-
return `${this.text.belowMinimum} ${this.formatMoney(slot.minimumBidCents)}.`;
|
|
2994
|
-
if (slot.incrementCents > 0 && (cents - slot.minimumBidCents) % slot.incrementCents !== 0)
|
|
2995
|
-
return this.text.step;
|
|
2996
|
-
return null;
|
|
2997
|
-
}
|
|
2998
|
-
submitBid(event) {
|
|
2999
|
-
event.preventDefault();
|
|
3000
|
-
const slot = this.selectedSlot;
|
|
3001
|
-
if (!slot || slot.isReserved || !this.biddingOpen || this.amountProblem(slot))
|
|
3002
|
-
return;
|
|
3003
|
-
const amountCents = Math.round((this.amountEuros ?? 0) * 100);
|
|
3004
|
-
const url = this.bidUrl(slot, amountCents);
|
|
3005
|
-
if (!url)
|
|
3006
|
-
return;
|
|
3007
|
-
this.dispatchEvent(new CustomEvent("wodira:shirt:bid-started", {
|
|
3008
|
-
bubbles: true,
|
|
3009
|
-
composed: true,
|
|
3010
|
-
detail: { campaignId: this.campaignId, slotId: slot.id, amountCents }
|
|
3011
|
-
}));
|
|
3012
|
-
const width = Math.min(1100, screen.availWidth);
|
|
3013
|
-
const height = Math.min(900, screen.availHeight);
|
|
3014
|
-
const left = Math.max(0, Math.round((screen.availWidth - width) / 2));
|
|
3015
|
-
const top = Math.max(0, Math.round((screen.availHeight - height) / 2));
|
|
3016
|
-
const popup = window.open(url, `wodira-shirt-${this.channel}`, `popup,width=${width},height=${height},left=${left},top=${top}`);
|
|
3017
|
-
if (!popup) {
|
|
3018
|
-
this.blockedUrl = url;
|
|
3019
|
-
this.status = "blocked";
|
|
3020
|
-
return;
|
|
3021
|
-
}
|
|
3022
|
-
this.bidWindow = popup;
|
|
3023
|
-
this.status = "waiting";
|
|
3024
|
-
this.watchBidWindow();
|
|
3025
|
-
}
|
|
3026
|
-
watchBidWindow() {
|
|
3027
|
-
clearInterval(this.bidWindowTimer);
|
|
3028
|
-
if (!this.bidWindow)
|
|
3029
|
-
return;
|
|
3030
|
-
this.bidWindowTimer = setInterval(() => {
|
|
3031
|
-
if (!this.bidWindow?.closed)
|
|
3032
|
-
return;
|
|
3033
|
-
clearInterval(this.bidWindowTimer);
|
|
3034
|
-
this.bidWindow = null;
|
|
3035
|
-
if (this.status === "waiting")
|
|
3036
|
-
this.status = "idle";
|
|
3037
|
-
this.load(true);
|
|
3038
|
-
}, 1000);
|
|
3039
|
-
}
|
|
3040
|
-
onMessage = (event) => {
|
|
3041
|
-
const app = this.appOrigin;
|
|
3042
|
-
if (!app || event.origin !== app.origin)
|
|
3043
|
-
return;
|
|
3044
|
-
if (!this.bidWindow || event.source !== this.bidWindow)
|
|
3045
|
-
return;
|
|
3046
|
-
const data = event.data;
|
|
3047
|
-
if (!data || typeof data !== "object" || !("type" in data) || data.type !== "wodira:shirt:paid" || !("channel" in data) || data.channel !== this.channel || !("campaignId" in data) || data.campaignId !== this.campaignId)
|
|
3048
|
-
return;
|
|
3049
|
-
this.status = "paid";
|
|
3050
|
-
this.load(true);
|
|
3051
|
-
this.dispatchEvent(new CustomEvent("wodira:shirt:paid", {
|
|
3052
|
-
bubbles: true,
|
|
3053
|
-
composed: true,
|
|
3054
|
-
detail: { campaignId: this.campaignId }
|
|
3055
|
-
}));
|
|
3056
|
-
};
|
|
3057
|
-
onWindowFocus = () => {
|
|
3058
|
-
if (this.status === "blocked")
|
|
3059
|
-
this.load(true);
|
|
3060
|
-
};
|
|
3061
|
-
onColorScheme = () => this.refreshTheme();
|
|
3062
|
-
render() {
|
|
3063
|
-
const text = this.text;
|
|
3064
|
-
if (!this.client)
|
|
3065
|
-
return html`<section part="container" aria-label=${text.label}>
|
|
3066
|
-
<p part="error" role="alert">${text.invalid}</p>
|
|
3067
|
-
</section>`;
|
|
3068
|
-
if (this.loading && !this.campaign)
|
|
3069
|
-
return html`<section part="container" aria-label=${text.label} aria-busy="true">
|
|
3070
|
-
<p part="loader" role="status">${text.loading}</p>
|
|
3071
|
-
</section>`;
|
|
3072
|
-
if (this.failed || !this.campaign)
|
|
3073
|
-
return html`<section part="container" aria-label=${text.label}>
|
|
3074
|
-
<p part="error" role="alert">${text.error}</p>
|
|
3075
|
-
<button part="button secondary" type="button" @click=${() => this.load()}>
|
|
3076
|
-
${text.retry}
|
|
3077
|
-
</button>
|
|
3078
|
-
</section>`;
|
|
3079
|
-
const campaign = this.campaign;
|
|
3080
|
-
return html`<section part="container" aria-label=${text.label}>
|
|
3081
|
-
<header part="header">
|
|
3082
|
-
<h2 part="title">${campaign.eventName}</h2>
|
|
3083
|
-
<p part="meta">
|
|
3084
|
-
<span>${[campaign.city, campaign.province].filter(Boolean).join(", ")}</span>
|
|
3085
|
-
<span>${campaign.shirtCount.toLocaleString(this.numberLocale)} ${text.shirts}</span>
|
|
3086
|
-
<span>${text.closes}: ${this.formatDate(campaign.closesAt)}</span>
|
|
3087
|
-
</p>
|
|
3088
|
-
</header>
|
|
3089
|
-
<div part="layout">
|
|
3090
|
-
<div part="stack">${this.renderStage()} ${this.renderSides()}</div>
|
|
3091
|
-
<div part="stack">${this.renderSlots()} ${this.renderBidPanel()}</div>
|
|
3092
|
-
</div>
|
|
3093
|
-
</section>`;
|
|
3094
|
-
}
|
|
3095
|
-
renderStage() {
|
|
3096
|
-
const text = this.text;
|
|
3097
|
-
if (this.modelUnavailable)
|
|
3098
|
-
return html`<div part="stage"><p part="stage-fallback">${text.noModel}</p></div>`;
|
|
3099
|
-
return html`<div part="stage">
|
|
3100
|
-
${keyed(this.canvasRevision, html`<canvas
|
|
3101
|
-
part="shirt"
|
|
3102
|
-
tabindex="0"
|
|
3103
|
-
role="img"
|
|
3104
|
-
aria-label=${text.shirtAria}
|
|
3105
|
-
@pointerdown=${this.onPointerDown}
|
|
3106
|
-
@pointermove=${this.onPointerMove}
|
|
3107
|
-
@pointerup=${this.onPointerUp}
|
|
3108
|
-
@pointercancel=${this.onPointerCancel}
|
|
3109
|
-
@lostpointercapture=${this.onPointerCancel}
|
|
3110
|
-
@keydown=${this.onShirtKey}
|
|
3111
|
-
></canvas>`)}
|
|
3112
|
-
${this.modelLoading ? html`<p part="stage-hint loader" role="status">${text.loading}</p>` : html`<p part="stage-hint">${text.hint}</p>`}
|
|
3113
|
-
<div part="stage-controls">
|
|
3114
|
-
<button
|
|
3115
|
-
part="zoom-button"
|
|
3116
|
-
type="button"
|
|
3117
|
-
aria-label=${text.zoomOut}
|
|
3118
|
-
@click=${() => this.renderer?.zoomBy(-0.1)}
|
|
3119
|
-
>
|
|
3120
|
-
−
|
|
3121
|
-
</button>
|
|
3122
|
-
<button
|
|
3123
|
-
part="zoom-button"
|
|
3124
|
-
type="button"
|
|
3125
|
-
aria-label=${text.zoomIn}
|
|
3126
|
-
@click=${() => this.renderer?.zoomBy(0.1)}
|
|
3127
|
-
>
|
|
3128
|
-
+
|
|
3129
|
-
</button>
|
|
3130
|
-
</div>
|
|
3131
|
-
</div>`;
|
|
3132
|
-
}
|
|
3133
|
-
renderSides() {
|
|
3134
|
-
return html`<div part="side-switch" role="group" aria-label=${this.text.views}>
|
|
3135
|
-
${this.sides.map((side) => html`<button
|
|
3136
|
-
part=${`side-button${this.side === side ? " side-button-active" : ""}`}
|
|
3137
|
-
type="button"
|
|
3138
|
-
aria-pressed=${String(this.side === side)}
|
|
3139
|
-
@click=${() => this.showSide(side)}
|
|
3140
|
-
>
|
|
3141
|
-
${this.text.sides[side]}
|
|
3142
|
-
</button>`)}
|
|
3143
|
-
</div>`;
|
|
3144
|
-
}
|
|
3145
|
-
renderSlots() {
|
|
3146
|
-
const text = this.text;
|
|
3147
|
-
return html`<div part="stack">
|
|
3148
|
-
<h3 part="section-title">${text.slots}</h3>
|
|
3149
|
-
<ul part="slot-list">
|
|
3150
|
-
${this.orderedSlots.map((slot) => {
|
|
3151
|
-
const selected = slot.id === this.selectedSlotId;
|
|
3152
|
-
const leading = slot.leadingAmountCents !== null && !!slot.leadingBrandName;
|
|
3153
|
-
const parts = ["slot", selected && "slot-selected", slot.isReserved && "slot-reserved"].filter(Boolean).join(" ");
|
|
3154
|
-
return html`<li>
|
|
3155
|
-
<button
|
|
3156
|
-
part=${parts}
|
|
3157
|
-
type="button"
|
|
3158
|
-
aria-pressed=${String(selected)}
|
|
3159
|
-
?disabled=${!!slot.isReserved}
|
|
3160
|
-
@click=${() => this.select(slot)}
|
|
3161
|
-
>
|
|
3162
|
-
<span part="slot-name">${slot.name}</span>
|
|
3163
|
-
<span part="slot-detail"
|
|
3164
|
-
>${text.sides[slot.side]} · ${slot.printWidthCm} × ${slot.printHeightCm} cm</span
|
|
3165
|
-
>
|
|
3166
|
-
<span part="slot-price price">
|
|
3167
|
-
${slot.isReserved ? html`<small>${text.reserved}</small>` : leading ? html`<small>${slot.leadingBrandName} ${text.leads}</small
|
|
3168
|
-
>${this.formatMoney(slot.leadingAmountCents ?? 0)}` : html`<small>${text.from}</small>${this.formatMoney(slot.minimumBidCents)}`}
|
|
3169
|
-
</span>
|
|
3170
|
-
</button>
|
|
3171
|
-
</li>`;
|
|
3172
|
-
})}
|
|
3173
|
-
</ul>
|
|
3174
|
-
</div>`;
|
|
3175
|
-
}
|
|
3176
|
-
renderBidPanel() {
|
|
3177
|
-
const text = this.text;
|
|
3178
|
-
const slot = this.selectedSlot;
|
|
3179
|
-
if (!slot)
|
|
3180
|
-
return html`<p part="hint">${text.pick}</p>`;
|
|
3181
|
-
if (slot.isReserved)
|
|
3182
|
-
return html`<div part="bid-panel">
|
|
3183
|
-
<h3 part="bid-title">${slot.name}</h3>
|
|
3184
|
-
<p part="hint">${text.reserved}</p>
|
|
3185
|
-
</div>`;
|
|
3186
|
-
const leading = slot.leadingAmountCents !== null && !!slot.leadingBrandName;
|
|
3187
|
-
const problem = this.amountProblem(slot);
|
|
3188
|
-
const amountCents = Math.round((this.amountEuros ?? 0) * 100);
|
|
3189
|
-
return html`<div part="bid-panel">
|
|
3190
|
-
<h3 part="bid-title">${slot.name}</h3>
|
|
3191
|
-
${leading ? html`<p part="leader">
|
|
3192
|
-
${slot.leadingArtworkUrl ? html`<img
|
|
3193
|
-
part="leader-logo"
|
|
3194
|
-
src=${slot.leadingArtworkUrl}
|
|
3195
|
-
alt=${slot.leadingBrandName ?? ""}
|
|
3196
|
-
loading="lazy"
|
|
3197
|
-
/>` : nothing}
|
|
3198
|
-
<span
|
|
3199
|
-
>${text.current}:
|
|
3200
|
-
<strong part="price">${this.formatMoney(slot.leadingAmountCents ?? 0)}</strong> ·
|
|
3201
|
-
${slot.leadingBrandName}</span
|
|
3202
|
-
>
|
|
3203
|
-
</p>` : nothing}
|
|
3204
|
-
<p part="hint">
|
|
3205
|
-
${text.minimum}: <strong>${this.formatMoney(slot.minimumBidCents)}</strong>.
|
|
3206
|
-
${text.increments} ${this.formatMoney(slot.incrementCents)}.
|
|
3207
|
-
</p>
|
|
3208
|
-
${this.biddingOpen ? html`<form part="bid-form" novalidate @submit=${this.submitBid}>
|
|
3209
|
-
<label part="label">
|
|
3210
|
-
${text.amount}
|
|
3211
|
-
<input
|
|
3212
|
-
part="input"
|
|
3213
|
-
type="number"
|
|
3214
|
-
inputmode="decimal"
|
|
3215
|
-
name="amount"
|
|
3216
|
-
.value=${this.amountEuros === null ? "" : String(this.amountEuros)}
|
|
3217
|
-
min=${slot.minimumBidCents / 100}
|
|
3218
|
-
step=${Math.max(1, slot.incrementCents) / 100}
|
|
3219
|
-
aria-invalid=${problem ? "true" : "false"}
|
|
3220
|
-
aria-describedby="bid-problem"
|
|
3221
|
-
@input=${(event) => {
|
|
3222
|
-
const value = event.target.valueAsNumber;
|
|
3223
|
-
this.amountEuros = Number.isFinite(value) ? value : null;
|
|
3224
|
-
}}
|
|
3225
|
-
/>
|
|
3226
|
-
</label>
|
|
3227
|
-
<p id="bid-problem" part="field-error" role="alert" ?hidden=${!problem}>
|
|
3228
|
-
${problem ?? ""}
|
|
3229
|
-
</p>
|
|
3230
|
-
<button part="button submit" type="submit" ?disabled=${!!problem}>
|
|
3231
|
-
${leading ? text.outbid : text.bid}${problem ? "" : ` · ${this.formatMoney(amountCents)}`}
|
|
3232
|
-
</button>
|
|
3233
|
-
<p part="hint">${text.note}</p>
|
|
3234
|
-
</form>` : html`<p part="hint">${text.closed}</p>`}
|
|
3235
|
-
${this.renderStatus()}
|
|
3236
|
-
</div>`;
|
|
3237
|
-
}
|
|
3238
|
-
renderStatus() {
|
|
3239
|
-
const text = this.text;
|
|
3240
|
-
switch (this.status) {
|
|
3241
|
-
case "waiting":
|
|
3242
|
-
return html`<p part="status hint" role="status">${text.waiting}</p>`;
|
|
3243
|
-
case "paid":
|
|
3244
|
-
return html`<p part="status success" role="status">${text.paid}</p>`;
|
|
3245
|
-
case "blocked":
|
|
3246
|
-
return html`<p part="status error" role="alert">
|
|
3247
|
-
${text.popupBlocked}
|
|
3248
|
-
<a href=${this.blockedUrl} target="_blank" rel="opener">${text.openBid}</a>
|
|
3249
|
-
</p>`;
|
|
3250
|
-
default:
|
|
3251
|
-
return nothing;
|
|
3252
|
-
}
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
|
|
3256
|
-
// src/ui/shirt-sponsors/index.ts
|
|
3257
|
-
function defineWodiraShirtElements2() {
|
|
3258
|
-
if (!globalThis.customElements)
|
|
3259
|
-
throw new Error("WODira shirt elements require a browser.");
|
|
3260
|
-
if (!customElements.get("wodira-shirt-auction"))
|
|
3261
|
-
customElements.define("wodira-shirt-auction", WodiraShirtAuction2);
|
|
3262
|
-
}
|
|
3263
|
-
|
|
3264
|
-
export { __export, __chunks, css, html, nothing, LitElement, WodiraBrowserApiError, createWodiraBrowserClient, wodiraUiStyles, WodiraShirtAuction2, defineWodiraShirtElements2 };
|
|
1746
|
+
export { __export, __preload, __chunks, css, html, svg, noChange, nothing, _$LH, LitElement, PartType, directive, Directive, WodiraBrowserApiError, createWodiraBrowserClient };
|