Skip to content

Commit 48680bc

Browse files
author
Herve Tribouilloy
committed
Increased version
1 parent 4be230b commit 48680bc

5 files changed

Lines changed: 107 additions & 10 deletions

File tree

vite_project/index.html

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,98 @@
11
<body>
22
<script type="module" src="./src/widget.ts"></script>
33

4-
<div class="usp" id="home-usp" style="min-height:45px">
5-
<usp-widget data-contract="/cdn/uk.json" />
4+
<div class="usp" id="home-usp">
5+
6+
<!-- Fallback content (SSR / static HTML) -->
7+
<div class="usp-fallback">
8+
9+
<!-- tile 1 -->
10+
<div class="usp-tile">
11+
<!-- bunk svg -->
12+
<svg viewBox="0 0 260 120">
13+
<svg viewBox="0 0 260 140" xmlns="http://www.w3.org/2000/svg">
14+
<rect x="2" y="2" width="256" height="136" rx="14" fill="#ffffff" stroke="#e2e8f0" stroke-width="2"/>
15+
16+
<!-- frame -->
17+
<line x1="40" y1="30" x2="40" y2="110" stroke="#334155" stroke-width="4"/>
18+
<line x1="200" y1="30" x2="200" y2="110" stroke="#334155" stroke-width="4"/>
19+
20+
<!-- bunks -->
21+
<rect x="40" y="34" width="160" height="10" rx="4" fill="#94a3b8"/>
22+
<rect x="40" y="54" width="160" height="10" rx="4" fill="#94a3b8"/>
23+
<rect x="40" y="74" width="160" height="10" rx="4" fill="#94a3b8"/>
24+
<rect x="40" y="94" width="160" height="10" rx="4" fill="#94a3b8"/>
25+
26+
<!-- ladder -->
27+
<line x1="22" y1="30" x2="22" y2="110" stroke="#475569" stroke-width="3"/>
28+
<line x1="32" y1="30" x2="32" y2="110" stroke="#475569" stroke-width="3"/>
29+
<line x1="22" y1="44" x2="32" y2="44" stroke="#475569" stroke-width="2"/>
30+
<line x1="22" y1="64" x2="32" y2="64" stroke="#475569" stroke-width="2"/>
31+
<line x1="22" y1="84" x2="32" y2="84" stroke="#475569" stroke-width="2"/>
32+
</svg>
33+
</svg>
34+
<span>Clear, Versioned Boundaries</span>
35+
</div>
36+
37+
<!-- tile 2 -->
38+
<div class="usp-tile">
39+
<svg viewBox="0 0 260 120">
40+
<svg viewBox="0 0 260 140" xmlns="http://www.w3.org/2000/svg">
41+
<rect x="2" y="2" width="256" height="136" rx="14" fill="#ffffff" stroke="#e2e8f0" stroke-width="2"/>
42+
43+
<!-- frame -->
44+
<line x1="40" y1="30" x2="40" y2="110" stroke="#334155" stroke-width="4"/>
45+
<line x1="200" y1="30" x2="200" y2="110" stroke="#334155" stroke-width="4"/>
46+
47+
<!-- bunks -->
48+
<rect x="40" y="34" width="160" height="10" rx="4" fill="#94a3b8"/>
49+
<rect x="40" y="54" width="160" height="10" rx="4" fill="#94a3b8"/>
50+
<rect x="40" y="74" width="160" height="10" rx="4" fill="#94a3b8"/>
51+
<rect x="40" y="94" width="160" height="10" rx="4" fill="#94a3b8"/>
52+
53+
<!-- ladder -->
54+
<line x1="22" y1="30" x2="22" y2="110" stroke="#475569" stroke-width="3"/>
55+
<line x1="32" y1="30" x2="32" y2="110" stroke="#475569" stroke-width="3"/>
56+
<line x1="22" y1="44" x2="32" y2="44" stroke="#475569" stroke-width="2"/>
57+
<line x1="22" y1="64" x2="32" y2="64" stroke="#475569" stroke-width="2"/>
58+
<line x1="22" y1="84" x2="32" y2="84" stroke="#475569" stroke-width="2"/>
59+
</svg>
60+
</svg>
61+
<span>Ship Without Expanding Risk</span>
62+
</div>
63+
64+
<!-- tile 3 -->
65+
<div class="usp-tile">
66+
<svg viewBox="0 0 260 120">
67+
<svg viewBox="0 0 260 140" xmlns="http://www.w3.org/2000/svg">
68+
<rect x="2" y="2" width="256" height="136" rx="14" fill="#ffffff" stroke="#e2e8f0" stroke-width="2"/>
69+
70+
<!-- frame -->
71+
<line x1="40" y1="30" x2="40" y2="110" stroke="#334155" stroke-width="4"/>
72+
<line x1="200" y1="30" x2="200" y2="110" stroke="#334155" stroke-width="4"/>
73+
74+
<!-- bunks -->
75+
<rect x="40" y="34" width="160" height="10" rx="4" fill="#94a3b8"/>
76+
<rect x="40" y="54" width="160" height="10" rx="4" fill="#94a3b8"/>
77+
<rect x="40" y="74" width="160" height="10" rx="4" fill="#94a3b8"/>
78+
<rect x="40" y="94" width="160" height="10" rx="4" fill="#94a3b8"/>
79+
80+
<!-- ladder -->
81+
<line x1="22" y1="30" x2="22" y2="110" stroke="#475569" stroke-width="3"/>
82+
<line x1="32" y1="30" x2="32" y2="110" stroke="#475569" stroke-width="3"/>
83+
<line x1="22" y1="44" x2="32" y2="44" stroke="#475569" stroke-width="2"/>
84+
<line x1="22" y1="64" x2="32" y2="64" stroke="#475569" stroke-width="2"/>
85+
<line x1="22" y1="84" x2="32" y2="84" stroke="#475569" stroke-width="2"/>
86+
</svg>
87+
</svg>
88+
<span>Works With Your Existing Platform</span>
89+
</div>
90+
91+
</div>
92+
93+
<!-- ReactEdge widget -->
94+
<usp-widget data-contract="/cdn/uk.json"></usp-widget>
95+
696
</div>
797

898
</body>

vite_project/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vite_project/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "widget-usp",
33
"private": true,
4-
"version": "0.2.2",
4+
"version": "0.2.3",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

vite_project/src/lib/fallback.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
export function fallback(root: HTMLElement) {
2-
const container = root.parentNode;
3-
const fallback = container?.querySelector(".fallback");
1+
import {activity} from "../activity";
2+
import {WIDGET_ID} from "../mountWidget.tsx";
43

5-
if (!fallback) return;
4+
export function fallback() {
5+
const fallbackId = `.${WIDGET_ID}-fallback`
6+
const fallback = document?.querySelector(fallbackId);
7+
8+
if (!fallback) {
9+
activity('fallback', 'Fallback not found', fallbackId, 'error');
10+
return;
11+
}
612

713
try {
814
fallback.setAttribute("style", "display: none");
15+
activity('fallback', 'Fallback disabled', fallback);
916
} catch {
1017
// fallback stays visible
1118
}

vite_project/src/mountWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ export function mountWidget(hostElement: HTMLElement) {
4040

4141
activity('bootstrap', 'Widget mounted');
4242

43-
fallback(hostElement)
43+
fallback()
4444
}

0 commit comments

Comments
 (0)