@bardioc/create-bardioc-app 0.5.3 → 0.5.5
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 +10 -13
- package/package.json +5 -5
- package/templates/angular/.env.example +6 -4
- package/templates/angular/public/runtime-env.js +1 -1
- package/templates/angular/scripts/dev-auth-proxy.mjs +6 -7
- package/templates/angular/scripts/sync-runtime-env.mjs +2 -24
- package/templates/angular/src/app/app.component.ts +4 -31
- package/templates/angular/src/app/bardioc-bridge.ts +3 -3
- package/templates/angular/src/index.html +2 -2
- package/templates/angular/src/main.ts +9 -43
- package/templates/angular/src/runtime-env.ts +1 -1
- package/templates/angular/src/styles.css +84 -80
- package/templates/angular/src/vite-env.d.ts +4 -6
- package/templates/manifest.json +2 -10
- package/templates/nextjs/.env.example +5 -6
- package/templates/nextjs/app/globals.css +31 -28
- package/templates/nextjs/app/page.tsx +17 -77
- package/templates/nextjs/global.d.ts +1 -1
- package/templates/nextjs/next.config.ts +27 -16
- package/templates/nextjs/package.json +2 -2
- package/templates/nextjs/tailwind.config.ts +1 -4
- package/templates/preact/.env.example +5 -9
- package/templates/preact/index.html +2 -2
- package/templates/preact/package.json +2 -2
- package/templates/preact/src/App.tsx +6 -5
- package/templates/preact/src/index.css +31 -28
- package/templates/preact/src/main.tsx +13 -29
- package/templates/preact/src/vite-env.d.ts +2 -4
- package/templates/solid/.env.example +5 -9
- package/templates/solid/index.html +2 -2
- package/templates/solid/package.json +2 -2
- package/templates/solid/src/App.tsx +6 -5
- package/templates/solid/src/bardioc-sdk.tsx +18 -18
- package/templates/solid/src/index.css +31 -28
- package/templates/solid/src/main.tsx +17 -33
- package/templates/solid/src/vite-env.d.ts +2 -4
- package/templates/svelte/.env.example +8 -4
- package/templates/svelte/index.html +2 -2
- package/templates/svelte/package.json +2 -2
- package/templates/svelte/src/App.svelte +1 -1
- package/templates/svelte/src/index.css +31 -28
- package/templates/svelte/src/main.ts +9 -25
- package/templates/svelte/src/vite-env.d.ts +2 -4
- package/templates/vite/.env.example +5 -10
- package/templates/vite/CLAUDE.md +8 -10
- package/templates/vite/index.html +2 -2
- package/templates/vite/package.json +2 -4
- package/templates/vite/src/App.tsx +1 -2
- package/templates/vite/src/auth/onboarding.tsx +5 -7
- package/templates/vite/src/climate/conditions-chart.tsx +6 -8
- package/templates/vite/src/events/live-events-view.tsx +1 -3
- package/templates/vite/src/i18n.tsx +7 -9
- package/templates/vite/src/locales/de.json +2 -3
- package/templates/vite/src/locales/en.json +2 -3
- package/templates/vite/src/main.tsx +18 -35
- package/templates/vite/src/shell/header.tsx +1 -2
- package/templates/vite/src/vite-env.d.ts +0 -2
- package/templates/vue/.env.example +8 -4
- package/templates/vue/index.html +2 -2
- package/templates/vue/package.json +2 -2
- package/templates/vue/src/App.vue +26 -10
- package/templates/vue/src/bardioc-sdk.ts +11 -11
- package/templates/vue/src/index.css +31 -28
- package/templates/vue/src/main.ts +8 -24
- package/templates/vue/src/vite-env.d.ts +2 -4
- package/templates/nextjs/app/proxy/route.ts +0 -85
|
@@ -1,258 +1,262 @@
|
|
|
1
1
|
* {
|
|
2
|
-
|
|
2
|
+
box-sizing: border-box;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
html,
|
|
6
6
|
body,
|
|
7
7
|
app-root {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
height: 100%;
|
|
11
|
+
width: 100%;
|
|
12
|
+
overflow: hidden;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
:root {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
--background: oklch(17.88% 0.0075 229.38);
|
|
17
|
+
--foreground: oklch(98.69% 0.0093 99.98);
|
|
18
|
+
--muted-foreground: oklch(86.03% 0.0056 95.11);
|
|
19
|
+
--border: oklch(1 0 0 / 10%);
|
|
20
|
+
--primary: oklch(97.02% 0 0);
|
|
21
|
+
--primary-foreground: oklch(36.94% 0.0053 236.64);
|
|
22
|
+
--destructive: oklch(68.04% 0.1386 21.38);
|
|
23
|
+
--ring: oklch(79.43% 0.0084 98.91);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
body {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
background: var(--background);
|
|
28
|
+
color: var(--foreground);
|
|
29
|
+
font-family:
|
|
30
|
+
system-ui,
|
|
31
|
+
-apple-system,
|
|
32
|
+
sans-serif;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
code {
|
|
33
|
-
|
|
36
|
+
font-family: inherit;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
.bg-background {
|
|
37
|
-
|
|
40
|
+
background-color: var(--background);
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
.text-foreground {
|
|
41
|
-
|
|
44
|
+
color: var(--foreground);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
.text-muted-foreground {
|
|
45
|
-
|
|
48
|
+
color: var(--muted-foreground);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
.border-border {
|
|
49
|
-
|
|
52
|
+
border-color: var(--border);
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
.bg-primary {
|
|
53
|
-
|
|
56
|
+
background-color: var(--primary);
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
.text-primary-foreground {
|
|
57
|
-
|
|
60
|
+
color: var(--primary-foreground);
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
.text-destructive {
|
|
61
|
-
|
|
64
|
+
color: var(--destructive);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
.focus\:ring-ring:focus {
|
|
65
|
-
|
|
68
|
+
--tw-ring-color: var(--ring);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
.hover\:bg-primary\/90:hover {
|
|
69
|
-
|
|
72
|
+
background-color: oklch(from var(--primary) calc(l * 0.9) c h);
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
.hover\:text-foreground:hover {
|
|
73
|
-
|
|
76
|
+
color: var(--foreground);
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
.mx-auto {
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
margin-left: auto;
|
|
81
|
+
margin-right: auto;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
.m-0 {
|
|
82
|
-
|
|
85
|
+
margin: 0;
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
.flex {
|
|
86
|
-
|
|
89
|
+
display: flex;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
.min-h-0 {
|
|
90
|
-
|
|
93
|
+
min-height: 0;
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
.min-h-screen {
|
|
94
|
-
|
|
97
|
+
min-height: 100vh;
|
|
95
98
|
}
|
|
96
99
|
|
|
97
100
|
.h-full {
|
|
98
|
-
|
|
101
|
+
height: 100%;
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
.w-full {
|
|
102
|
-
|
|
105
|
+
width: 100%;
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
.max-w-2xl {
|
|
106
|
-
|
|
109
|
+
max-width: 42rem;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
.max-w-3xl {
|
|
110
|
-
|
|
113
|
+
max-width: 48rem;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
.shrink-0 {
|
|
114
|
-
|
|
117
|
+
flex-shrink: 0;
|
|
115
118
|
}
|
|
116
119
|
|
|
117
120
|
.flex-1 {
|
|
118
|
-
|
|
121
|
+
flex: 1 1 0%;
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
.flex-col {
|
|
122
|
-
|
|
125
|
+
flex-direction: column;
|
|
123
126
|
}
|
|
124
127
|
|
|
125
128
|
.flex-wrap {
|
|
126
|
-
|
|
129
|
+
flex-wrap: wrap;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
.items-center {
|
|
130
|
-
|
|
133
|
+
align-items: center;
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
.justify-center {
|
|
134
|
-
|
|
137
|
+
justify-content: center;
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
.gap-0 {
|
|
138
|
-
|
|
141
|
+
gap: 0;
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
.gap-1 {
|
|
142
|
-
|
|
145
|
+
gap: 0.25rem;
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
.gap-2 {
|
|
146
|
-
|
|
149
|
+
gap: 0.5rem;
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
.gap-3 {
|
|
150
|
-
|
|
153
|
+
gap: 0.75rem;
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
.gap-4 {
|
|
154
|
-
|
|
157
|
+
gap: 1rem;
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
.overflow-hidden {
|
|
158
|
-
|
|
161
|
+
overflow: hidden;
|
|
159
162
|
}
|
|
160
163
|
|
|
161
164
|
.overflow-auto {
|
|
162
|
-
|
|
165
|
+
overflow: auto;
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
.rounded {
|
|
166
|
-
|
|
169
|
+
border-radius: 0.25rem;
|
|
167
170
|
}
|
|
168
171
|
|
|
169
172
|
.rounded-xl {
|
|
170
|
-
|
|
173
|
+
border-radius: 0.75rem;
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
.border {
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
border-width: 1px;
|
|
178
|
+
border-style: solid;
|
|
176
179
|
}
|
|
177
180
|
|
|
178
181
|
.border-b {
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
border-bottom-width: 1px;
|
|
183
|
+
border-bottom-style: solid;
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
.p-3 {
|
|
184
|
-
|
|
187
|
+
padding: 0.75rem;
|
|
185
188
|
}
|
|
186
189
|
|
|
187
190
|
.p-4 {
|
|
188
|
-
|
|
191
|
+
padding: 1rem;
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
.px-3 {
|
|
192
|
-
|
|
193
|
-
|
|
195
|
+
padding-left: 0.75rem;
|
|
196
|
+
padding-right: 0.75rem;
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
.py-1 {
|
|
197
|
-
|
|
198
|
-
|
|
200
|
+
padding-top: 0.25rem;
|
|
201
|
+
padding-bottom: 0.25rem;
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
.pb-2 {
|
|
202
|
-
|
|
205
|
+
padding-bottom: 0.5rem;
|
|
203
206
|
}
|
|
204
207
|
|
|
205
208
|
.text-center {
|
|
206
|
-
|
|
209
|
+
text-align: center;
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
.text-2xl {
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
font-size: 1.5rem;
|
|
214
|
+
line-height: 2rem;
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
.text-xs {
|
|
215
|
-
|
|
216
|
-
|
|
218
|
+
font-size: 0.75rem;
|
|
219
|
+
line-height: 1rem;
|
|
217
220
|
}
|
|
218
221
|
|
|
219
222
|
.text-\[11px\] {
|
|
220
|
-
|
|
223
|
+
font-size: 11px;
|
|
221
224
|
}
|
|
222
225
|
|
|
223
226
|
.font-medium {
|
|
224
|
-
|
|
227
|
+
font-weight: 500;
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
.font-semibold {
|
|
228
|
-
|
|
231
|
+
font-weight: 600;
|
|
229
232
|
}
|
|
230
233
|
|
|
231
234
|
.font-mono {
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
font-family:
|
|
236
|
+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
|
|
237
|
+
monospace;
|
|
234
238
|
}
|
|
235
239
|
|
|
236
240
|
.leading-5 {
|
|
237
|
-
|
|
241
|
+
line-height: 1.25rem;
|
|
238
242
|
}
|
|
239
243
|
|
|
240
244
|
.whitespace-pre-wrap {
|
|
241
|
-
|
|
245
|
+
white-space: pre-wrap;
|
|
242
246
|
}
|
|
243
247
|
|
|
244
248
|
.break-all {
|
|
245
|
-
|
|
249
|
+
word-break: break-all;
|
|
246
250
|
}
|
|
247
251
|
|
|
248
252
|
.bg-muted\/20 {
|
|
249
|
-
|
|
253
|
+
background-color: oklch(from var(--muted-foreground) l c h / 0.2);
|
|
250
254
|
}
|
|
251
255
|
|
|
252
256
|
.disabled\:opacity-50:disabled {
|
|
253
|
-
|
|
257
|
+
opacity: 0.5;
|
|
254
258
|
}
|
|
255
259
|
|
|
256
260
|
.disabled\:cursor-not-allowed:disabled {
|
|
257
|
-
|
|
261
|
+
cursor: not-allowed;
|
|
258
262
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
interface ImportMetaEnv {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
readonly VITE_APP_NAME?: string;
|
|
5
|
-
readonly VITE_ENABLE_DEV_AUTH?: string;
|
|
2
|
+
readonly DEV?: boolean;
|
|
3
|
+
readonly VITE_APP_NAME?: string;
|
|
6
4
|
}
|
|
7
5
|
|
|
8
6
|
interface ImportMeta {
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
readonly env: ImportMetaEnv;
|
|
8
|
+
}
|
package/templates/manifest.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
NEXT_PUBLIC_APP_NAME={{APP_NAME}}
|
|
2
|
-
NEXT_PUBLIC_APP_ID=your-app-client-id-here
|
|
3
|
-
NEXT_PUBLIC_ENABLE_DEV_AUTH=false
|
|
4
2
|
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
# Shared secret used for dev auth when proxying API requests through /rest.
|
|
4
|
+
DEV_SECRET=
|
|
5
|
+
|
|
6
|
+
# Base URL of the Bardioc API backend to proxy /rest requests to.
|
|
7
|
+
API_BASE_URL=
|
|
@@ -1,75 +1,78 @@
|
|
|
1
1
|
@import 'tailwindcss';
|
|
2
2
|
|
|
3
3
|
* {
|
|
4
|
-
|
|
4
|
+
box-sizing: border-box;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
html,
|
|
8
8
|
body {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
height: 100%;
|
|
12
|
+
width: 100%;
|
|
13
|
+
overflow: hidden;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
:root {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
--background: oklch(17.88% 0.0075 229.38);
|
|
18
|
+
--foreground: oklch(98.69% 0.0093 99.98);
|
|
19
|
+
--muted-foreground: oklch(86.03% 0.0056 95.11);
|
|
20
|
+
--border: oklch(1 0 0 / 10%);
|
|
21
|
+
--primary: oklch(97.02% 0 0);
|
|
22
|
+
--primary-foreground: oklch(36.94% 0.0053 236.64);
|
|
23
|
+
--destructive: oklch(68.04% 0.1386 21.38);
|
|
24
|
+
--ring: oklch(79.43% 0.0084 98.91);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
body {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
background: var(--background);
|
|
29
|
+
color: var(--foreground);
|
|
30
|
+
font-family:
|
|
31
|
+
system-ui,
|
|
32
|
+
-apple-system,
|
|
33
|
+
sans-serif;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
code {
|
|
34
|
-
|
|
37
|
+
font-family: inherit;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
.bg-background {
|
|
38
|
-
|
|
41
|
+
background-color: var(--background);
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
.text-foreground {
|
|
42
|
-
|
|
45
|
+
color: var(--foreground);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
.text-muted-foreground {
|
|
46
|
-
|
|
49
|
+
color: var(--muted-foreground);
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
.border-border {
|
|
50
|
-
|
|
53
|
+
border-color: var(--border);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
.bg-primary {
|
|
54
|
-
|
|
57
|
+
background-color: var(--primary);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
.text-primary-foreground {
|
|
58
|
-
|
|
61
|
+
color: var(--primary-foreground);
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
.text-destructive {
|
|
62
|
-
|
|
65
|
+
color: var(--destructive);
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
.focus\:ring-ring:focus {
|
|
66
|
-
|
|
69
|
+
--tw-ring-color: var(--ring);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
.hover\:bg-primary\/90:hover {
|
|
70
|
-
|
|
73
|
+
background-color: oklch(from var(--primary) calc(l * 0.9) c h);
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
.hover\:text-foreground:hover {
|
|
74
|
-
|
|
77
|
+
color: var(--foreground);
|
|
75
78
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { installDevBridge, isDevStandalone, isInsideIframe } from '@bardioc/app-sdk/dev';
|
|
4
4
|
import { AppSdkProvider, useNotify, useSdk } from '@bardioc/app-sdk/react';
|
|
5
|
-
import { useEffect, useState
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
type ResultState =
|
|
8
8
|
| { status: 'idle' }
|
|
@@ -10,33 +10,7 @@ type ResultState =
|
|
|
10
10
|
| { status: 'success'; request: string; data: unknown }
|
|
11
11
|
| { status: 'error'; request: string; message: string };
|
|
12
12
|
|
|
13
|
-
type InjectedDevAuthConfig = {
|
|
14
|
-
hostUrl?: string;
|
|
15
|
-
sessionKey?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
13
|
const APP_NAME = process.env.NEXT_PUBLIC_APP_NAME?.trim();
|
|
19
|
-
const APP_ID = process.env.NEXT_PUBLIC_APP_ID?.trim();
|
|
20
|
-
const standaloneDevAuthEnabled =
|
|
21
|
-
process.env.NODE_ENV === 'development' && process.env.NEXT_PUBLIC_ENABLE_DEV_AUTH === 'true';
|
|
22
|
-
const DEV_AUTH_HOST_URL = process.env.NEXT_PUBLIC_DEV_AUTH_HOST_URL?.trim();
|
|
23
|
-
const DEV_SESSION_KEY = process.env.NEXT_PUBLIC_DEV_SESSION_KEY?.trim();
|
|
24
|
-
|
|
25
|
-
function installInjectedDevAuthConfig() {
|
|
26
|
-
if (!DEV_AUTH_HOST_URL || !DEV_SESSION_KEY) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
(
|
|
31
|
-
window as Window &
|
|
32
|
-
typeof globalThis & {
|
|
33
|
-
__BARDIOC_DEV_AUTH__?: InjectedDevAuthConfig;
|
|
34
|
-
}
|
|
35
|
-
).__BARDIOC_DEV_AUTH__ = {
|
|
36
|
-
hostUrl: DEV_AUTH_HOST_URL,
|
|
37
|
-
sessionKey: DEV_SESSION_KEY,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
14
|
|
|
41
15
|
function SdkDemo() {
|
|
42
16
|
const bridge = useSdk();
|
|
@@ -89,14 +63,14 @@ function SdkDemo() {
|
|
|
89
63
|
|
|
90
64
|
<div className="flex flex-wrap gap-2">
|
|
91
65
|
<button
|
|
92
|
-
className="bg-primary text-primary-foreground hover:bg-primary/90
|
|
66
|
+
className="bg-primary text-primary-foreground hover:bg-primary/90 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50"
|
|
93
67
|
onClick={() => void runGetProfile()}
|
|
94
68
|
disabled={running}
|
|
95
69
|
>
|
|
96
70
|
Get Profile
|
|
97
71
|
</button>
|
|
98
72
|
<button
|
|
99
|
-
className="bg-primary text-primary-foreground hover:bg-primary/90
|
|
73
|
+
className="bg-primary text-primary-foreground hover:bg-primary/90 rounded px-3 py-1 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50"
|
|
100
74
|
onClick={handleNotify}
|
|
101
75
|
disabled={running}
|
|
102
76
|
>
|
|
@@ -161,62 +135,28 @@ function PreviewShell() {
|
|
|
161
135
|
);
|
|
162
136
|
}
|
|
163
137
|
|
|
164
|
-
function DevAuthProvider({ children, enabled }: { children: ReactNode; enabled: boolean }) {
|
|
165
|
-
const requiresStandaloneDevAuth = enabled && standaloneDevAuthEnabled && !!APP_ID && !!APP_NAME;
|
|
166
|
-
const [ready, setReady] = useState(!requiresStandaloneDevAuth);
|
|
167
|
-
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
if (!requiresStandaloneDevAuth) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
installInjectedDevAuthConfig();
|
|
174
|
-
|
|
175
|
-
ensureDevAuthSession({ appId: APP_ID, appName: APP_NAME })
|
|
176
|
-
.then(() => {
|
|
177
|
-
installDevBridge({ appId: APP_ID, appName: APP_NAME, debug: false });
|
|
178
|
-
setReady(true);
|
|
179
|
-
})
|
|
180
|
-
.catch(error => {
|
|
181
|
-
console.error('[template-smoke-nextjs] failed to initialize dev bridge', error);
|
|
182
|
-
setReady(true);
|
|
183
|
-
});
|
|
184
|
-
}, [requiresStandaloneDevAuth]);
|
|
185
|
-
|
|
186
|
-
if (!ready) {
|
|
187
|
-
return (
|
|
188
|
-
<div className="flex min-h-screen items-center justify-center">
|
|
189
|
-
<div className="text-muted-foreground text-xs">Initializing dev bridge...</div>
|
|
190
|
-
</div>
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return <>{children}</>;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
138
|
export default function Page() {
|
|
198
|
-
const useSdkProvider =
|
|
199
|
-
standaloneDevAuthEnabled || (typeof window !== 'undefined' && window.parent !== window);
|
|
139
|
+
const useSdkProvider = isInsideIframe() || isDevStandalone();
|
|
200
140
|
|
|
201
141
|
if (!APP_NAME) {
|
|
202
142
|
throw new Error('Missing NEXT_PUBLIC_APP_NAME for runtime');
|
|
203
143
|
}
|
|
204
144
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (isDevStandalone()) {
|
|
147
|
+
installDevBridge();
|
|
148
|
+
}
|
|
149
|
+
}, []);
|
|
208
150
|
|
|
209
151
|
return (
|
|
210
152
|
<div className="bg-background text-foreground min-h-screen">
|
|
211
|
-
|
|
212
|
-
{
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
)}
|
|
219
|
-
</DevAuthProvider>
|
|
153
|
+
{useSdkProvider ? (
|
|
154
|
+
<AppSdkProvider appId={APP_NAME}>
|
|
155
|
+
<SdkDemo />
|
|
156
|
+
</AppSdkProvider>
|
|
157
|
+
) : (
|
|
158
|
+
<PreviewShell />
|
|
159
|
+
)}
|
|
220
160
|
</div>
|
|
221
161
|
);
|
|
222
162
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
declare module '*.css';
|
|
1
|
+
declare module '*.css';
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import type { NextConfig } from 'next';
|
|
2
2
|
|
|
3
|
+
const apiBaseUrl = process.env.API_BASE_URL?.replace(/\/$/, '');
|
|
4
|
+
const devSecret = process.env.DEV_SECRET;
|
|
5
|
+
|
|
3
6
|
const nextConfig: NextConfig = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
output: 'export',
|
|
8
|
+
images: {
|
|
9
|
+
unoptimized: true,
|
|
10
|
+
},
|
|
11
|
+
trailingSlash: true,
|
|
12
|
+
async headers() {
|
|
13
|
+
if (!devSecret) return [];
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
source: '/rest/:path*',
|
|
17
|
+
headers: [{ key: 'X-Dev-Secret', value: devSecret }],
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
},
|
|
21
|
+
async rewrites() {
|
|
22
|
+
if (!apiBaseUrl) return [];
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
source: '/rest/:path*',
|
|
26
|
+
destination: `${apiBaseUrl}/:path*`,
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
},
|
|
19
30
|
};
|
|
20
31
|
|
|
21
|
-
export default nextConfig;
|
|
32
|
+
export default nextConfig;
|