@adminide-stack/yantra-mobile 12.0.142-alpha.0 → 12.0.144
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/lib/features/attachments/displayUserMessageText.js +2 -2
- package/lib/features/attachments/displayUserMessageText.js.map +1 -1
- package/lib/features/devices/bodyComposition.js +116 -0
- package/lib/features/devices/bodyComposition.js.map +1 -0
- package/lib/features/devices/readings.js.map +1 -1
- package/lib/features/devices/session.js +22 -2
- package/lib/features/devices/session.js.map +1 -1
- package/lib/features/notion/NotionAgentPanel.js +987 -0
- package/lib/features/notion/NotionAgentPanel.js.map +1 -0
- package/lib/features/notion/NotionAskAiSheet.js +362 -0
- package/lib/features/notion/NotionAskAiSheet.js.map +1 -0
- package/lib/features/notion/NotionBlockView.js +4 -3
- package/lib/features/notion/NotionBlockView.js.map +1 -1
- package/lib/features/notion/NotionConnectionsSheet.js +47 -13
- package/lib/features/notion/NotionConnectionsSheet.js.map +1 -1
- package/lib/features/notion/NotionPageView.js +68 -8
- package/lib/features/notion/NotionPageView.js.map +1 -1
- package/lib/features/notion/NotionSidebarSections.js +1 -1
- package/lib/features/notion/NotionSidebarSections.js.map +1 -1
- package/lib/features/notion/NotionWorkspaceView.js +14 -9
- package/lib/features/notion/NotionWorkspaceView.js.map +1 -1
- package/lib/features/notion/database/DatabaseCells.js +3 -1
- package/lib/features/notion/database/DatabaseCells.js.map +1 -1
- package/lib/features/notion/database/DatabaseDateLayouts.js +1 -1
- package/lib/features/notion/database/DatabaseDateLayouts.js.map +1 -1
- package/lib/features/notion/database/NotionDatabaseView.js +1 -1
- package/lib/features/notion/database/NotionDatabaseView.js.map +1 -1
- package/lib/features/notion/notionAgentRunStatus.js +2 -2
- package/lib/features/notion/notionAgentRunStatus.js.map +1 -1
- package/lib/features/notion/notionAgentRuns.js +57 -0
- package/lib/features/notion/notionAgentRuns.js.map +1 -0
- package/lib/features/notion/notionAiContext.js +91 -0
- package/lib/features/notion/notionAiContext.js.map +1 -0
- package/lib/features/notion/notionConnections.js +42 -4
- package/lib/features/notion/notionConnections.js.map +1 -1
- package/lib/features/notion/notionDocuments.js +61 -1
- package/lib/features/notion/notionDocuments.js.map +1 -1
- package/lib/features/notion/notionNotesAgent.js +173 -3
- package/lib/features/notion/notionNotesAgent.js.map +1 -1
- package/lib/features/notion/notionPageKinds.js +1 -1
- package/lib/features/webbuilder/WebBuilderExperience.js +229 -97
- package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
- package/lib/features/webbuilder/buildFragments.js +33 -7
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/buildJob.js +2 -2
- package/lib/features/webbuilder/buildJob.js.map +1 -1
- package/lib/features/webbuilder/codeFiles.js +18 -1
- package/lib/features/webbuilder/codeFiles.js.map +1 -1
- package/lib/features/webbuilder/components/BottomTabs.js.map +1 -1
- package/lib/features/webbuilder/components/CodeView.js +134 -56
- package/lib/features/webbuilder/components/CodeView.js.map +1 -1
- package/lib/features/webbuilder/components/Composer.js +2 -2
- package/lib/features/webbuilder/components/Composer.js.map +1 -1
- package/lib/features/webbuilder/components/PreviewFrame.js +19 -3
- package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
- package/lib/features/webbuilder/components/PreviewScreen.js +310 -46
- package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectChat.js +141 -12
- package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
- package/lib/features/webbuilder/components/ProjectSheets.js +792 -0
- package/lib/features/webbuilder/components/ProjectSheets.js.map +1 -0
- package/lib/features/webbuilder/components/ProjectsScreen.js +14 -2
- package/lib/features/webbuilder/components/ProjectsScreen.js.map +1 -1
- package/lib/features/webbuilder/components/PublishSheet.js +914 -58
- package/lib/features/webbuilder/components/PublishSheet.js.map +1 -1
- package/lib/features/webbuilder/components/TemplateCard.js +9 -6
- package/lib/features/webbuilder/components/TemplateCard.js.map +1 -1
- package/lib/features/webbuilder/components/TemplatesSheet.js +5 -17
- package/lib/features/webbuilder/components/TemplatesSheet.js.map +1 -1
- package/lib/features/webbuilder/connectorTemplates.js +171 -0
- package/lib/features/webbuilder/connectorTemplates.js.map +1 -0
- package/lib/features/webbuilder/fileTree.js +163 -0
- package/lib/features/webbuilder/fileTree.js.map +1 -0
- package/lib/features/webbuilder/followUps.js +67 -0
- package/lib/features/webbuilder/followUps.js.map +1 -0
- package/lib/features/webbuilder/previewProbe.js +49 -0
- package/lib/features/webbuilder/previewProbe.js.map +1 -0
- package/lib/features/webbuilder/previewRoutes.js +156 -0
- package/lib/features/webbuilder/previewRoutes.js.map +1 -0
- package/lib/features/webbuilder/projectTools.js +341 -0
- package/lib/features/webbuilder/projectTools.js.map +1 -0
- package/lib/features/webbuilder/publishTools.js +475 -0
- package/lib/features/webbuilder/publishTools.js.map +1 -0
- package/lib/features/webbuilder/sleepNotice.js +13 -0
- package/lib/features/webbuilder/sleepNotice.js.map +1 -0
- package/lib/features/webbuilder/stepLabels.js +37 -7
- package/lib/features/webbuilder/stepLabels.js.map +1 -1
- package/lib/features/webbuilder/studioCatalog.js +5 -1
- package/lib/features/webbuilder/studioCatalog.js.map +1 -1
- package/lib/features/webbuilder/templateCatalog.js +140 -0
- package/lib/features/webbuilder/templateCatalog.js.map +1 -0
- package/lib/features/webbuilder/webbuilderPrompts.js +31 -5
- package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -1
- package/lib/features/webbuilder/workflow.js +8 -4
- package/lib/features/webbuilder/workflow.js.map +1 -1
- package/lib/screens/Devices/index.js +205 -3
- package/lib/screens/Devices/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +9 -6
- package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -1
- package/lib/screens/WebBuilderNative/index.js +1 -1
- package/lib/screens/WebBuilderNative/index.js.map +1 -1
- package/lib/screens/WebBuilderNative/keepAlive.js +53 -3
- package/lib/screens/WebBuilderNative/keepAlive.js.map +1 -1
- package/lib/screens/WebBuilderNative/unreachableRetry.js +23 -0
- package/lib/screens/WebBuilderNative/unreachableRetry.js.map +1 -0
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js +37 -0
- package/lib/screens/WebBuilderNative/useConnectorTemplates.js.map +1 -0
- package/lib/screens/WebBuilderNative/useSandboxKeepAlive.js +6 -0
- package/lib/screens/WebBuilderNative/useSandboxKeepAlive.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +302 -40
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderJobs.js +2 -2
- package/lib/screens/WebBuilderNative/useWebBuilderJobs.js.map +1 -1
- package/lib/screens/WebBuilderNative/versionUndo.js +1 -1
- package/lib/screens/WebBuilderNative/versionUndo.js.map +1 -1
- package/lib/screens/WebBuilderNative/webbuilderTransport.js +147 -77
- package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,72 +1,605 @@
|
|
|
1
|
-
import {jsx,jsxs}from'react/jsx-runtime';import {useState,useEffect}from'react';import {StyleSheet,Text,View,Linking,
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useState,useEffect,useCallback,useMemo}from'react';import {StyleSheet,Text,View,TextInput,ScrollView,Linking,Clipboard,Alert,ActivityIndicator}from'react-native';import {MaterialCommunityIcons}from'@expo/vector-icons';import {Tap,DIM}from'../../inbox/components/Tap.js';import {publishSlug,displayHost,isValidPublishSlug}from'../buildFragments.js';import {EXPORT_TARGETS}from'../exportCode.js';import {publishKind,projectNameOfLiveUrl,AI_BUSY_TEXT,publishStatusLine,publishPrimaryLabel,UNPUBLISH_ACTION,unpublishParams,plainActionError,CUSTOM_DOMAIN_ACTION,domainStatusParams,parseDomainDns,isNotAttachedError,normalizeDomain,isValidDomain,dnsStateText,REGISTRAR_GUIDES,parsePrePublishReport,reviewFindings,findingsForTab,scoreBadges,TAB_EMPTY,domainSteps,formatTtl,recordHostLabel,recordValueLabel,dnsStateLabel,removeDomainParams,attachDomainParams,SEVERITY_LABEL}from'../publishTools.js';import {PrimaryButton,Sheet,SecondaryButton}from'./ui.js';var _a;
|
|
2
|
+
let AsyncStorage = null;
|
|
3
|
+
try {
|
|
4
|
+
AsyncStorage = (_a = require("@react-native-async-storage/async-storage").default) != null ? _a : null;
|
|
5
|
+
} catch (e) {
|
|
6
|
+
AsyncStorage = null;
|
|
7
|
+
}
|
|
8
|
+
const domainKey = (projectName) => `yantra.webbuilder.customDomain.${projectName}`;
|
|
9
|
+
const DOMAIN_TIMEOUT_MS = 6e4;
|
|
10
|
+
const UNPUBLISH_TIMEOUT_MS = 12e4;
|
|
11
|
+
function toneColors(tone, theme) {
|
|
12
|
+
if (tone === "success") return {
|
|
13
|
+
bg: theme.goodSoft,
|
|
14
|
+
ink: theme.good
|
|
15
|
+
};
|
|
16
|
+
if (tone === "warning") return {
|
|
17
|
+
bg: theme.warnSoft,
|
|
18
|
+
ink: theme.warn
|
|
19
|
+
};
|
|
20
|
+
if (tone === "info") return {
|
|
21
|
+
bg: theme.infoSoft,
|
|
22
|
+
ink: theme.info
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
bg: theme.chip,
|
|
26
|
+
ink: theme.muted
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function StatusPill({
|
|
30
|
+
tone,
|
|
31
|
+
text,
|
|
32
|
+
theme
|
|
33
|
+
}) {
|
|
34
|
+
const c = toneColors(tone, theme);
|
|
35
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.pill, {
|
|
36
|
+
backgroundColor: c.bg
|
|
37
|
+
}], testID: "webbuilder-publish-status", children: [
|
|
38
|
+
/* @__PURE__ */ jsx(View, { style: [styles.pillDot, {
|
|
39
|
+
backgroundColor: c.ink
|
|
40
|
+
}] }),
|
|
41
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.pillText, {
|
|
42
|
+
color: c.ink
|
|
43
|
+
}], children: text })
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
function SectionTitle({
|
|
47
|
+
children,
|
|
48
|
+
theme
|
|
49
|
+
}) {
|
|
50
|
+
return /* @__PURE__ */ jsx(Text, { style: [styles.section, {
|
|
51
|
+
color: theme.muted
|
|
52
|
+
}], children });
|
|
53
|
+
}
|
|
54
|
+
function MenuRow({
|
|
55
|
+
icon,
|
|
56
|
+
label,
|
|
57
|
+
hint,
|
|
58
|
+
onPress,
|
|
59
|
+
theme,
|
|
60
|
+
trailing = "chevron-right",
|
|
61
|
+
disabled = false,
|
|
62
|
+
danger = false,
|
|
63
|
+
testID
|
|
64
|
+
}) {
|
|
65
|
+
return /* @__PURE__ */ jsxs(Tap, { onPress, disabled, accessibilityRole: "button", accessibilityLabel: hint ? `${label}. ${hint}` : label, style: [styles.row, disabled && styles.disabled], pressedStyle: DIM, testID, children: [
|
|
66
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: icon, size: 20, color: danger ? theme.crit : theme.muted }),
|
|
67
|
+
/* @__PURE__ */ jsxs(View, { style: styles.rowText, children: [
|
|
68
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.rowLabel, {
|
|
69
|
+
color: danger ? theme.crit : theme.ink
|
|
70
|
+
}], children: label }),
|
|
71
|
+
hint ? /* @__PURE__ */ jsx(Text, { style: [styles.rowHint, {
|
|
72
|
+
color: theme.muted
|
|
73
|
+
}], children: hint }) : null
|
|
74
|
+
] }),
|
|
75
|
+
trailing ? /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: trailing, size: 20, color: theme.faint }) : null
|
|
76
|
+
] });
|
|
77
|
+
}
|
|
78
|
+
function Divider({
|
|
79
|
+
theme
|
|
80
|
+
}) {
|
|
81
|
+
return /* @__PURE__ */ jsx(View, { style: [styles.divider, {
|
|
82
|
+
backgroundColor: theme.border
|
|
83
|
+
}] });
|
|
84
|
+
}
|
|
85
|
+
function BackRow({
|
|
86
|
+
label,
|
|
87
|
+
onPress,
|
|
88
|
+
theme
|
|
89
|
+
}) {
|
|
90
|
+
return /* @__PURE__ */ jsxs(Tap, { onPress, accessibilityRole: "button", accessibilityLabel: `Back to ${label}`, style: styles.back, pressedStyle: DIM, children: [
|
|
91
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "chevron-left", size: 22, color: theme.ink }),
|
|
92
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.backText, {
|
|
93
|
+
color: theme.ink
|
|
94
|
+
}], children: label })
|
|
95
|
+
] });
|
|
96
|
+
}
|
|
97
|
+
function copy(text) {
|
|
98
|
+
try {
|
|
99
|
+
Clipboard.setString(text);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function StepList({
|
|
104
|
+
view,
|
|
105
|
+
attached,
|
|
106
|
+
theme
|
|
107
|
+
}) {
|
|
108
|
+
const steps = domainSteps({
|
|
109
|
+
attached,
|
|
110
|
+
state: view == null ? void 0 : view.state,
|
|
111
|
+
autoConfigured: view == null ? void 0 : view.autoConfigured
|
|
112
|
+
});
|
|
113
|
+
return /* @__PURE__ */ jsx(View, { style: styles.steps, children: steps.map((s, i) => {
|
|
114
|
+
const done = s.status === "done";
|
|
115
|
+
const failed = s.status === "failed";
|
|
116
|
+
const active = s.status === "active";
|
|
117
|
+
let ring = theme.border;
|
|
118
|
+
if (done) ring = theme.good;
|
|
119
|
+
else if (failed) ring = theme.crit;
|
|
120
|
+
else if (active) ring = theme.accent;
|
|
121
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.step, children: [
|
|
122
|
+
/* @__PURE__ */ jsx(View, { style: [styles.stepDot, {
|
|
123
|
+
borderColor: ring,
|
|
124
|
+
backgroundColor: done ? theme.good : "transparent"
|
|
125
|
+
}], children: done ? /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "check", size: 14, color: theme.card }) : /* @__PURE__ */ jsx(Text, { style: [styles.stepNum, {
|
|
126
|
+
color: failed ? theme.crit : theme.muted
|
|
127
|
+
}], children: i + 1 }) }),
|
|
128
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.stepLabel, {
|
|
129
|
+
color: active || done ? theme.ink : theme.muted
|
|
130
|
+
}], numberOfLines: 2, children: s.label })
|
|
131
|
+
] }, s.id);
|
|
132
|
+
}) });
|
|
133
|
+
}
|
|
134
|
+
function RecordCard({
|
|
135
|
+
row,
|
|
136
|
+
domain,
|
|
137
|
+
theme
|
|
138
|
+
}) {
|
|
139
|
+
const ttl = formatTtl(row.ttl);
|
|
140
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.record, {
|
|
141
|
+
borderColor: theme.border,
|
|
142
|
+
backgroundColor: theme.screen
|
|
143
|
+
}], children: [
|
|
144
|
+
/* @__PURE__ */ jsxs(View, { style: styles.recordHead, children: [
|
|
145
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.recordType, {
|
|
146
|
+
color: theme.ink,
|
|
147
|
+
backgroundColor: theme.chip
|
|
148
|
+
}], children: row.type }),
|
|
149
|
+
row.state ? /* @__PURE__ */ jsx(Text, { style: [styles.rowHint, {
|
|
150
|
+
color: row.state === "active" ? theme.good : theme.muted
|
|
151
|
+
}], children: dnsStateLabel(row.state) }) : null,
|
|
152
|
+
ttl ? /* @__PURE__ */ jsxs(Text, { style: [styles.rowHint, {
|
|
153
|
+
color: theme.muted
|
|
154
|
+
}], children: [
|
|
155
|
+
"TTL ",
|
|
156
|
+
ttl
|
|
157
|
+
] }) : null
|
|
158
|
+
] }),
|
|
159
|
+
[{
|
|
160
|
+
label: recordHostLabel(row.name, domain),
|
|
161
|
+
value: row.name
|
|
162
|
+
}, {
|
|
163
|
+
label: recordValueLabel(row.type),
|
|
164
|
+
value: row.value
|
|
165
|
+
}].map((f) => /* @__PURE__ */ jsxs(View, { style: styles.recordField, children: [
|
|
166
|
+
/* @__PURE__ */ jsxs(View, { style: styles.rowText, children: [
|
|
167
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.rowHint, {
|
|
168
|
+
color: theme.muted
|
|
169
|
+
}], children: f.label }),
|
|
170
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.mono, {
|
|
171
|
+
color: theme.ink
|
|
172
|
+
}], selectable: true, children: f.value })
|
|
173
|
+
] }),
|
|
174
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => copy(f.value), accessibilityRole: "button", accessibilityLabel: `Copy ${f.label}`, hitSlop: 8, pressedStyle: DIM, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "content-copy", size: 18, color: theme.muted }) })
|
|
175
|
+
] }, f.label)),
|
|
176
|
+
row.note ? /* @__PURE__ */ jsx(Text, { style: [styles.rowHint, {
|
|
177
|
+
color: theme.muted
|
|
178
|
+
}], children: row.note }) : null
|
|
179
|
+
] });
|
|
180
|
+
}
|
|
181
|
+
function DomainPage({
|
|
182
|
+
build,
|
|
183
|
+
live,
|
|
184
|
+
projectName,
|
|
185
|
+
tools,
|
|
186
|
+
aiBusy,
|
|
187
|
+
onPublishWithDomain,
|
|
188
|
+
onBack,
|
|
189
|
+
theme
|
|
190
|
+
}) {
|
|
191
|
+
var _a2;
|
|
192
|
+
const [input, setInput] = useState("");
|
|
193
|
+
const [domain, setDomain] = useState(null);
|
|
194
|
+
const [view, setView] = useState(null);
|
|
195
|
+
const [busy, setBusy] = useState(null);
|
|
196
|
+
const [error, setError] = useState(null);
|
|
197
|
+
const [guide, setGuide] = useState(null);
|
|
198
|
+
const status = useCallback(async (d, retry = false) => {
|
|
199
|
+
setBusy("status");
|
|
200
|
+
setError(null);
|
|
201
|
+
const r = await tools.run(build, CUSTOM_DOMAIN_ACTION, domainStatusParams(projectName, d, retry), DOMAIN_TIMEOUT_MS);
|
|
202
|
+
setBusy(null);
|
|
203
|
+
if (r.successful) {
|
|
204
|
+
setView(parseDomainDns(r.data, d));
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (isNotAttachedError(r.error, r.data)) {
|
|
208
|
+
setDomain(null);
|
|
209
|
+
setView(null);
|
|
210
|
+
setInput(d);
|
|
211
|
+
AsyncStorage == null ? void 0 : AsyncStorage.removeItem(domainKey(projectName)).catch(() => void 0);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
setError(plainActionError(r.error, "Couldn't read the domain's status. Try again."));
|
|
215
|
+
}, [build, projectName, tools]);
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
if (!projectName || !live) return;
|
|
218
|
+
let alive = true;
|
|
219
|
+
AsyncStorage == null ? void 0 : AsyncStorage.getItem(domainKey(projectName)).then((stored) => {
|
|
220
|
+
const d = normalizeDomain(stored || "");
|
|
221
|
+
if (!alive || !d) return;
|
|
222
|
+
setDomain(d);
|
|
223
|
+
status(d).catch(() => void 0);
|
|
224
|
+
}).catch(() => void 0);
|
|
225
|
+
return () => {
|
|
226
|
+
alive = false;
|
|
227
|
+
};
|
|
228
|
+
}, [projectName, live, status]);
|
|
229
|
+
const typed = normalizeDomain(input);
|
|
230
|
+
const valid = isValidDomain(typed);
|
|
231
|
+
const attach = async () => {
|
|
232
|
+
if (!valid) return;
|
|
233
|
+
if (!live) {
|
|
234
|
+
onPublishWithDomain(typed);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
setBusy("attach");
|
|
238
|
+
setError(null);
|
|
239
|
+
const r = await tools.run(build, CUSTOM_DOMAIN_ACTION, attachDomainParams(projectName, typed), DOMAIN_TIMEOUT_MS);
|
|
240
|
+
setBusy(null);
|
|
241
|
+
if (!r.successful) {
|
|
242
|
+
setError(plainActionError(r.error, "Couldn't add the domain. Check the spelling, then try again."));
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
setDomain(typed);
|
|
246
|
+
setView(parseDomainDns(r.data, typed));
|
|
247
|
+
AsyncStorage == null ? void 0 : AsyncStorage.setItem(domainKey(projectName), typed).catch(() => void 0);
|
|
248
|
+
};
|
|
249
|
+
const remove = () => {
|
|
250
|
+
if (!domain) return;
|
|
251
|
+
Alert.alert(`Remove ${domain}?`, "The site stays live on its own address.", [{
|
|
252
|
+
text: "Cancel",
|
|
253
|
+
style: "cancel"
|
|
254
|
+
}, {
|
|
255
|
+
text: "Remove",
|
|
256
|
+
style: "destructive",
|
|
257
|
+
onPress: () => {
|
|
258
|
+
setBusy("remove");
|
|
259
|
+
tools.run(build, CUSTOM_DOMAIN_ACTION, removeDomainParams(projectName, domain), DOMAIN_TIMEOUT_MS).then((r) => {
|
|
260
|
+
if (!r.successful) {
|
|
261
|
+
setError(plainActionError(r.error, "Couldn't remove the domain. Try again."));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
AsyncStorage == null ? void 0 : AsyncStorage.removeItem(domainKey(projectName)).catch(() => void 0);
|
|
265
|
+
setDomain(null);
|
|
266
|
+
setView(null);
|
|
267
|
+
setInput("");
|
|
268
|
+
}).catch(() => setError("Couldn't remove the domain. Try again.")).finally(() => setBusy(null));
|
|
269
|
+
}
|
|
270
|
+
}]);
|
|
271
|
+
};
|
|
272
|
+
const attached = Boolean(domain);
|
|
273
|
+
return /* @__PURE__ */ jsxs(ScrollView, { style: styles.page, contentContainerStyle: styles.pageBody, keyboardShouldPersistTaps: "handled", children: [
|
|
274
|
+
/* @__PURE__ */ jsx(BackRow, { label: "Publish", onPress: onBack, theme }),
|
|
275
|
+
/* @__PURE__ */ jsx(StepList, { view, attached, theme }),
|
|
276
|
+
attached && domain ? /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
|
|
277
|
+
/* @__PURE__ */ jsxs(View, { style: styles.domainHead, children: [
|
|
278
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "web", size: 20, color: theme.ink }),
|
|
279
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.domainName, {
|
|
280
|
+
color: theme.ink
|
|
281
|
+
}], numberOfLines: 1, children: domain }),
|
|
282
|
+
busy === "status" ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: theme.accent }) : null
|
|
283
|
+
] }),
|
|
284
|
+
view ? /* @__PURE__ */ jsx(Text, { style: [styles.note, {
|
|
285
|
+
color: view.state === "error" ? theme.crit : theme.muted
|
|
286
|
+
}, view.state === "active" && {
|
|
287
|
+
color: theme.good
|
|
288
|
+
}], children: view.errorMessage || dnsStateText(view.state) }) : null,
|
|
289
|
+
(view == null ? void 0 : view.suggestion) ? /* @__PURE__ */ jsxs(Text, { style: [styles.note, {
|
|
290
|
+
color: theme.muted
|
|
291
|
+
}], children: [
|
|
292
|
+
view.suggestion.why || "Connect this address instead:",
|
|
293
|
+
" ",
|
|
294
|
+
view.suggestion.domain
|
|
295
|
+
] }) : null,
|
|
296
|
+
view == null ? void 0 : view.records.map((row) => /* @__PURE__ */ jsx(RecordCard, { row, domain, theme }, `${row.type}-${row.name}-${row.value}`)),
|
|
297
|
+
(view == null ? void 0 : view.records.length) ? /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
|
|
298
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.label, {
|
|
299
|
+
color: theme.muted
|
|
300
|
+
}], children: "Where you bought the domain" }),
|
|
301
|
+
/* @__PURE__ */ jsx(View, { style: styles.chips, children: REGISTRAR_GUIDES.map((g) => /* @__PURE__ */ jsx(Tap, { onPress: () => setGuide(guide === g.id ? null : g.id), accessibilityRole: "button", accessibilityState: {
|
|
302
|
+
selected: guide === g.id
|
|
303
|
+
}, style: [styles.chip, {
|
|
304
|
+
borderColor: guide === g.id ? theme.accent : theme.border,
|
|
305
|
+
backgroundColor: guide === g.id ? theme.accentSoft : theme.card
|
|
306
|
+
}], pressedStyle: DIM, children: /* @__PURE__ */ jsx(Text, { style: [styles.chipText, {
|
|
307
|
+
color: theme.ink
|
|
308
|
+
}], children: g.label }) }, g.id)) }),
|
|
309
|
+
guide ? (_a2 = REGISTRAR_GUIDES.find((g) => g.id === guide)) == null ? void 0 : _a2.steps.map((step, i) => /* @__PURE__ */ jsxs(Text, { style: [styles.note, {
|
|
310
|
+
color: theme.ink
|
|
311
|
+
}], children: [
|
|
312
|
+
i + 1,
|
|
313
|
+
". ",
|
|
314
|
+
step
|
|
315
|
+
] }, step)) : null
|
|
316
|
+
] }) : null,
|
|
317
|
+
(view == null ? void 0 : view.state) !== "active" ? /* @__PURE__ */ jsx(PrimaryButton, { label: "Check again", icon: "refresh", onPress: () => {
|
|
318
|
+
status(domain, true).catch(() => void 0);
|
|
319
|
+
}, theme, busy: busy === "status" }) : null,
|
|
320
|
+
/* @__PURE__ */ jsx(SecondaryButton, { label: "Remove domain", icon: "trash-can-outline", onPress: remove, theme })
|
|
321
|
+
] }) : /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
|
|
322
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.label, {
|
|
323
|
+
color: theme.ink
|
|
324
|
+
}], children: "Domain you own" }),
|
|
325
|
+
/* @__PURE__ */ jsx(TextInput, { value: input, onChangeText: setInput, placeholder: "www.yourname.com", placeholderTextColor: theme.faint, autoCapitalize: "none", autoCorrect: false, keyboardType: "url", returnKeyType: "done", onSubmitEditing: () => {
|
|
326
|
+
attach().catch(() => void 0);
|
|
327
|
+
}, style: [styles.input, styles.field, {
|
|
328
|
+
color: theme.ink,
|
|
329
|
+
borderColor: input && !valid ? theme.crit : theme.accent
|
|
330
|
+
}], accessibilityLabel: "Domain you own", testID: "webbuilder-domain-input" }),
|
|
331
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
332
|
+
color: theme.muted
|
|
333
|
+
}], children: live ? "We add it to your site and show the DNS record to add where you bought it." : "Your site needs to be published first: we publish it with this domain." }),
|
|
334
|
+
aiBusy && !live ? /* @__PURE__ */ jsxs(Text, { style: [styles.help, {
|
|
335
|
+
color: theme.muted
|
|
336
|
+
}], children: [
|
|
337
|
+
AI_BUSY_TEXT,
|
|
338
|
+
", then publish."
|
|
339
|
+
] }) : null,
|
|
340
|
+
/* @__PURE__ */ jsx(PrimaryButton, { label: live ? "Add domain" : "Publish with this domain", onPress: () => {
|
|
341
|
+
attach().catch(() => void 0);
|
|
342
|
+
}, theme, busy: busy === "attach", disabled: !valid || !live && aiBusy, testID: "webbuilder-domain-submit" })
|
|
343
|
+
] }),
|
|
344
|
+
error ? /* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
345
|
+
color: theme.crit
|
|
346
|
+
}], children: error }) : null
|
|
347
|
+
] });
|
|
348
|
+
}
|
|
349
|
+
const TABS = [{
|
|
350
|
+
id: "security",
|
|
351
|
+
label: "Security",
|
|
352
|
+
icon: "shield-check-outline"
|
|
353
|
+
}, {
|
|
354
|
+
id: "seo",
|
|
355
|
+
label: "SEO",
|
|
356
|
+
icon: "magnify"
|
|
357
|
+
}, {
|
|
358
|
+
id: "speed",
|
|
359
|
+
label: "Speed",
|
|
360
|
+
icon: "speedometer"
|
|
361
|
+
}];
|
|
362
|
+
function FindingCard({
|
|
363
|
+
finding,
|
|
364
|
+
onFix,
|
|
365
|
+
fixDisabled,
|
|
366
|
+
theme
|
|
367
|
+
}) {
|
|
368
|
+
const problem = finding.status === "problem";
|
|
369
|
+
let icon = "minus-circle-outline";
|
|
370
|
+
let tint = theme.muted;
|
|
371
|
+
if (finding.status === "ok") {
|
|
372
|
+
icon = "check-circle-outline";
|
|
373
|
+
tint = theme.good;
|
|
374
|
+
} else if (problem) {
|
|
375
|
+
icon = finding.severity === "critical" ? "alert-octagon-outline" : "alert-outline";
|
|
376
|
+
tint = finding.severity === "critical" ? theme.crit : theme.warn;
|
|
377
|
+
}
|
|
378
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.finding, {
|
|
379
|
+
borderColor: theme.border
|
|
380
|
+
}], children: [
|
|
381
|
+
/* @__PURE__ */ jsxs(View, { style: styles.findingHead, children: [
|
|
382
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: icon, size: 20, color: tint }),
|
|
383
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.rowLabel, styles.rowText, {
|
|
384
|
+
color: theme.ink
|
|
385
|
+
}], children: finding.title }),
|
|
386
|
+
problem && finding.severity ? /* @__PURE__ */ jsx(Text, { style: [styles.rowHint, {
|
|
387
|
+
color: tint
|
|
388
|
+
}], children: SEVERITY_LABEL[finding.severity] }) : null
|
|
389
|
+
] }),
|
|
390
|
+
finding.detail ? /* @__PURE__ */ jsx(Text, { style: [styles.note, {
|
|
391
|
+
color: theme.muted
|
|
392
|
+
}], children: finding.detail }) : null,
|
|
393
|
+
problem && finding.why ? /* @__PURE__ */ jsx(Text, { style: [styles.note, {
|
|
394
|
+
color: theme.muted
|
|
395
|
+
}], children: finding.why }) : null,
|
|
396
|
+
finding.fixText && onFix ? /* @__PURE__ */ jsx(SecondaryButton, { label: "Fix with AI", icon: "auto-fix", onPress: () => {
|
|
397
|
+
if (!fixDisabled && finding.fixText) onFix(finding.fixText);
|
|
398
|
+
}, theme }) : null
|
|
399
|
+
] });
|
|
400
|
+
}
|
|
401
|
+
function ReviewPage({
|
|
402
|
+
build,
|
|
403
|
+
tools,
|
|
404
|
+
aiBusy,
|
|
405
|
+
onFix,
|
|
406
|
+
onPublish,
|
|
407
|
+
onBack,
|
|
408
|
+
theme
|
|
409
|
+
}) {
|
|
410
|
+
const [tab, setTab] = useState("security");
|
|
411
|
+
const [report, setReport] = useState(null);
|
|
412
|
+
const [loading, setLoading] = useState(true);
|
|
413
|
+
const [nonce, setNonce] = useState(0);
|
|
414
|
+
useEffect(() => {
|
|
415
|
+
if (!tools.review) {
|
|
416
|
+
setLoading(false);
|
|
417
|
+
return void 0;
|
|
418
|
+
}
|
|
419
|
+
let alive = true;
|
|
420
|
+
setLoading(true);
|
|
421
|
+
tools.review(build).then((raw) => {
|
|
422
|
+
if (alive) setReport(parsePrePublishReport(raw));
|
|
423
|
+
}).catch(() => {
|
|
424
|
+
if (alive) setReport(null);
|
|
425
|
+
}).finally(() => {
|
|
426
|
+
if (alive) setLoading(false);
|
|
427
|
+
});
|
|
428
|
+
return () => {
|
|
429
|
+
alive = false;
|
|
430
|
+
};
|
|
431
|
+
}, [build, tools, nonce]);
|
|
432
|
+
const findings = useMemo(() => reviewFindings(report), [report]);
|
|
433
|
+
const shown = findingsForTab(findings, tab);
|
|
434
|
+
const badges = tab === "speed" ? scoreBadges(report) : [];
|
|
435
|
+
const empty = TAB_EMPTY[tab];
|
|
436
|
+
const toneOf = (t) => {
|
|
437
|
+
if (t === "good") return theme.good;
|
|
438
|
+
return t === "ok" ? theme.warn : theme.crit;
|
|
439
|
+
};
|
|
440
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.page, children: [
|
|
441
|
+
/* @__PURE__ */ jsxs(View, { style: styles.reviewHead, children: [
|
|
442
|
+
/* @__PURE__ */ jsx(BackRow, { label: "Publish", onPress: onBack, theme }),
|
|
443
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => setNonce((n) => n + 1), accessibilityRole: "button", accessibilityLabel: "Run the checks again", hitSlop: 8, pressedStyle: DIM, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "refresh", size: 20, color: theme.muted }) })
|
|
444
|
+
] }),
|
|
445
|
+
/* @__PURE__ */ jsx(View, { style: [styles.tabs, {
|
|
446
|
+
borderBottomColor: theme.border
|
|
447
|
+
}], children: TABS.map((t) => /* @__PURE__ */ jsxs(Tap, { onPress: () => setTab(t.id), accessibilityRole: "tab", accessibilityState: {
|
|
448
|
+
selected: tab === t.id
|
|
449
|
+
}, style: [styles.tab, tab === t.id && {
|
|
450
|
+
backgroundColor: theme.chip
|
|
451
|
+
}], pressedStyle: DIM, testID: `webbuilder-review-${t.id}`, children: [
|
|
452
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: t.icon, size: 16, color: tab === t.id ? theme.ink : theme.muted }),
|
|
453
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.tabText, {
|
|
454
|
+
color: tab === t.id ? theme.ink : theme.muted
|
|
455
|
+
}], children: t.label })
|
|
456
|
+
] }, t.id)) }),
|
|
457
|
+
/* @__PURE__ */ jsxs(ScrollView, { style: styles.page, contentContainerStyle: styles.pageBody, children: [
|
|
458
|
+
loading ? /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.accent, style: styles.spin }) : null,
|
|
459
|
+
!loading && badges.length ? /* @__PURE__ */ jsx(View, { style: styles.badges, children: badges.map((b) => /* @__PURE__ */ jsxs(View, { style: [styles.badge, {
|
|
460
|
+
borderColor: theme.border
|
|
461
|
+
}], children: [
|
|
462
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.badgeValue, {
|
|
463
|
+
color: toneOf(b.tone)
|
|
464
|
+
}], children: b.value }),
|
|
465
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.rowHint, {
|
|
466
|
+
color: theme.muted
|
|
467
|
+
}], children: b.label })
|
|
468
|
+
] }, b.key)) }) : null,
|
|
469
|
+
!loading && !shown.length && !badges.length ? /* @__PURE__ */ jsxs(View, { style: styles.empty, children: [
|
|
470
|
+
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "shield-check-outline", size: 26, color: theme.muted }),
|
|
471
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.emptyTitle, {
|
|
472
|
+
color: theme.ink
|
|
473
|
+
}], children: empty.title }),
|
|
474
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.note, styles.center, {
|
|
475
|
+
color: theme.muted
|
|
476
|
+
}], children: empty.body })
|
|
477
|
+
] }) : null,
|
|
478
|
+
!loading ? shown.map((f) => /* @__PURE__ */ jsx(FindingCard, { finding: f, onFix, fixDisabled: aiBusy, theme }, f.key)) : null,
|
|
479
|
+
aiBusy && shown.some((f) => f.fixText) ? /* @__PURE__ */ jsxs(Text, { style: [styles.help, {
|
|
480
|
+
color: theme.muted
|
|
481
|
+
}], children: [
|
|
482
|
+
AI_BUSY_TEXT,
|
|
483
|
+
", then fix."
|
|
484
|
+
] }) : null
|
|
485
|
+
] }),
|
|
486
|
+
/* @__PURE__ */ jsx(View, { style: [styles.footer, {
|
|
487
|
+
borderTopColor: theme.border
|
|
488
|
+
}], children: /* @__PURE__ */ jsx(PrimaryButton, { label: "Publish\u2026", onPress: onPublish, theme, disabled: aiBusy }) })
|
|
489
|
+
] });
|
|
490
|
+
}
|
|
491
|
+
function PublishSheet({
|
|
2
492
|
visible,
|
|
3
493
|
build,
|
|
4
494
|
publishing,
|
|
5
495
|
onPublish,
|
|
6
496
|
onClose,
|
|
7
|
-
theme
|
|
497
|
+
theme,
|
|
498
|
+
liveUrl,
|
|
499
|
+
aiBusy = false,
|
|
500
|
+
tools,
|
|
501
|
+
onDownloadCode,
|
|
502
|
+
onExport,
|
|
503
|
+
onOwnCloudflare,
|
|
504
|
+
onFixWithAi,
|
|
505
|
+
onUnpublished
|
|
8
506
|
}) {
|
|
9
|
-
|
|
507
|
+
const [page, setPage] = useState("menu");
|
|
10
508
|
const [name, setName] = useState("");
|
|
509
|
+
const [pendingDomain, setPendingDomain] = useState(null);
|
|
11
510
|
const [starting, setStarting] = useState(false);
|
|
12
511
|
const [error, setError] = useState(null);
|
|
512
|
+
const [exportOpen, setExportOpen] = useState(false);
|
|
513
|
+
const [unpublishing, setUnpublishing] = useState(false);
|
|
514
|
+
const [offline, setOffline] = useState(false);
|
|
515
|
+
const live = offline ? null : liveUrl || (build == null ? void 0 : build.liveUrl) || null;
|
|
516
|
+
const kind = publishKind({
|
|
517
|
+
liveUrl: live,
|
|
518
|
+
buildLive: Boolean(build == null ? void 0 : build.liveUrl)
|
|
519
|
+
});
|
|
520
|
+
const status = publishStatusLine(kind, publishing);
|
|
521
|
+
const liveName = projectNameOfLiveUrl(live);
|
|
522
|
+
const projectName = liveName || name;
|
|
13
523
|
useEffect(() => {
|
|
14
|
-
if (!visible
|
|
15
|
-
|
|
524
|
+
if (!visible) return;
|
|
525
|
+
setPage("menu");
|
|
16
526
|
setError(null);
|
|
17
|
-
|
|
18
|
-
|
|
527
|
+
setExportOpen(false);
|
|
528
|
+
setPendingDomain(null);
|
|
529
|
+
}, [visible]);
|
|
530
|
+
useEffect(() => {
|
|
531
|
+
if (!build) return;
|
|
532
|
+
setName((prev) => prev || liveName || publishSlug(build.title));
|
|
533
|
+
}, [build, liveName]);
|
|
534
|
+
useEffect(() => setOffline(false), [liveUrl]);
|
|
19
535
|
const valid = isValidPublishSlug(name);
|
|
20
|
-
const
|
|
21
|
-
|
|
536
|
+
const blocked = aiBusy && !publishing ? `${AI_BUSY_TEXT}, then publish.` : null;
|
|
537
|
+
const start = async (projectNameToUse, customDomain) => {
|
|
538
|
+
if (!build || !onPublish) return;
|
|
22
539
|
setStarting(true);
|
|
23
540
|
setError(null);
|
|
24
541
|
try {
|
|
25
|
-
const result = await onPublish(build,
|
|
542
|
+
const result = await onPublish(build, projectNameToUse, customDomain);
|
|
26
543
|
if (!result.ok) setError(result.message || "Publishing didn't start. Try again.");
|
|
544
|
+
else setPage("menu");
|
|
27
545
|
} catch (e) {
|
|
28
546
|
setError("Publishing didn't start. Check your connection and try again.");
|
|
29
547
|
} finally {
|
|
30
548
|
setStarting(false);
|
|
31
549
|
}
|
|
32
550
|
};
|
|
551
|
+
const primary = () => {
|
|
552
|
+
if (kind !== "never" && liveName) {
|
|
553
|
+
start(liveName).catch(() => void 0);
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
setPage("name");
|
|
557
|
+
};
|
|
558
|
+
const unpublish = () => {
|
|
559
|
+
if (!build || !tools || !liveName) return;
|
|
560
|
+
Alert.alert("Unpublish this site?", `${displayHost(live)} stops working until you publish again.`, [{
|
|
561
|
+
text: "Cancel",
|
|
562
|
+
style: "cancel"
|
|
563
|
+
}, {
|
|
564
|
+
text: "Unpublish",
|
|
565
|
+
style: "destructive",
|
|
566
|
+
onPress: () => {
|
|
567
|
+
setUnpublishing(true);
|
|
568
|
+
setError(null);
|
|
569
|
+
AsyncStorage == null ? void 0 : AsyncStorage.getItem(domainKey(liveName)).catch(() => null).then((domain) => tools.run(build, UNPUBLISH_ACTION, unpublishParams(liveName, domain), UNPUBLISH_TIMEOUT_MS)).then((r) => {
|
|
570
|
+
const data = r.data && typeof r.data === "object" ? r.data : {};
|
|
571
|
+
if (r.successful && data.unpublished !== false) {
|
|
572
|
+
setOffline(true);
|
|
573
|
+
onUnpublished == null ? void 0 : onUnpublished();
|
|
574
|
+
} else {
|
|
575
|
+
setError(plainActionError(r.error, "Couldn't take the site offline. Try again."));
|
|
576
|
+
}
|
|
577
|
+
}).catch(() => setError("Couldn't take the site offline. Try again.")).finally(() => setUnpublishing(false));
|
|
578
|
+
}
|
|
579
|
+
}]);
|
|
580
|
+
};
|
|
33
581
|
let body;
|
|
34
582
|
if (!(build == null ? void 0 : build.sandboxId)) {
|
|
35
583
|
body = /* @__PURE__ */ jsx(Text, { style: [styles.note, {
|
|
36
584
|
color: theme.muted
|
|
37
585
|
}], children: "There is nothing to publish yet. Build the site first, then publish it here." });
|
|
38
|
-
} else if (
|
|
39
|
-
body = /* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
586
|
+
} else if (page === "domain" && tools) {
|
|
587
|
+
body = /* @__PURE__ */ jsx(DomainPage, { build, live: kind !== "never", projectName, tools, aiBusy, onPublishWithDomain: (domain) => {
|
|
588
|
+
setPendingDomain(domain);
|
|
589
|
+
setPage("name");
|
|
590
|
+
}, onBack: () => setPage("menu"), theme });
|
|
591
|
+
} else if (page === "review" && tools) {
|
|
592
|
+
body = /* @__PURE__ */ jsx(ReviewPage, { build, tools, aiBusy, onFix: onFixWithAi ? (text) => {
|
|
593
|
+
onClose();
|
|
594
|
+
onFixWithAi(text);
|
|
595
|
+
} : void 0, onPublish: () => setPage("menu"), onBack: () => setPage("menu"), theme });
|
|
596
|
+
} else if (page === "name") {
|
|
46
597
|
body = /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
|
|
47
|
-
|
|
48
|
-
backgroundColor: theme.goodSoft
|
|
49
|
-
}], testID: "webbuilder-live", children: [
|
|
50
|
-
/* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "earth", size: 20, color: theme.good }),
|
|
51
|
-
/* @__PURE__ */ jsx(Text, { style: [styles.liveHost, {
|
|
52
|
-
color: theme.good
|
|
53
|
-
}], numberOfLines: 1, children: displayHost(live) })
|
|
54
|
-
] }) : null,
|
|
55
|
-
live ? /* @__PURE__ */ jsxs(View, { style: styles.row, children: [
|
|
56
|
-
/* @__PURE__ */ jsx(SecondaryButton, { label: "Open", icon: "open-in-new", onPress: () => {
|
|
57
|
-
Linking.openURL(live).catch(() => void 0);
|
|
58
|
-
}, theme }),
|
|
59
|
-
/* @__PURE__ */ jsx(SecondaryButton, { label: "Share", icon: "share-variant-outline", onPress: () => {
|
|
60
|
-
Share.share({
|
|
61
|
-
message: live,
|
|
62
|
-
url: live
|
|
63
|
-
}).catch(() => void 0);
|
|
64
|
-
}, theme })
|
|
65
|
-
] }) : null,
|
|
598
|
+
/* @__PURE__ */ jsx(BackRow, { label: "Publish", onPress: () => setPage("menu"), theme }),
|
|
66
599
|
/* @__PURE__ */ jsx(Text, { style: [styles.label, {
|
|
67
600
|
color: theme.muted
|
|
68
|
-
}], children:
|
|
69
|
-
/* @__PURE__ */ jsxs(View, { style: [styles.field, {
|
|
601
|
+
}], children: "Site address" }),
|
|
602
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.field, styles.nameField, {
|
|
70
603
|
backgroundColor: theme.chip,
|
|
71
604
|
borderColor: valid ? theme.border : theme.crit
|
|
72
605
|
}], children: [
|
|
@@ -80,50 +613,218 @@ import {jsx,jsxs}from'react/jsx-runtime';import {useState,useEffect}from'react';
|
|
|
80
613
|
!valid && name ? /* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
81
614
|
color: theme.crit
|
|
82
615
|
}], children: "Letters, numbers and dashes; it cannot start or end with a dash." }) : null,
|
|
616
|
+
pendingDomain ? /* @__PURE__ */ jsxs(Text, { style: [styles.help, {
|
|
617
|
+
color: theme.muted
|
|
618
|
+
}], children: [
|
|
619
|
+
"Published with ",
|
|
620
|
+
pendingDomain,
|
|
621
|
+
" as its domain."
|
|
622
|
+
] }) : null,
|
|
623
|
+
blocked ? /* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
624
|
+
color: theme.muted
|
|
625
|
+
}], children: blocked }) : null,
|
|
83
626
|
error ? /* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
84
627
|
color: theme.crit
|
|
85
628
|
}], children: error }) : null,
|
|
86
|
-
/* @__PURE__ */ jsx(PrimaryButton, { label:
|
|
87
|
-
|
|
88
|
-
}, theme, busy: starting, disabled: !valid || !onPublish, testID: "webbuilder-publish-submit" })
|
|
629
|
+
/* @__PURE__ */ jsx(PrimaryButton, { label: pendingDomain ? "Publish with this domain" : "Publish", icon: "rocket-launch-outline", onPress: () => {
|
|
630
|
+
start(name, pendingDomain != null ? pendingDomain : void 0).catch(() => void 0);
|
|
631
|
+
}, theme, busy: starting, disabled: !valid || !onPublish || Boolean(blocked), testID: "webbuilder-publish-submit" })
|
|
632
|
+
] });
|
|
633
|
+
} else {
|
|
634
|
+
body = /* @__PURE__ */ jsxs(ScrollView, { style: styles.page, contentContainerStyle: styles.menuBody, children: [
|
|
635
|
+
/* @__PURE__ */ jsxs(View, { style: styles.block, children: [
|
|
636
|
+
/* @__PURE__ */ jsx(StatusPill, { tone: status.tone, text: status.text, theme }),
|
|
637
|
+
live ? /* @__PURE__ */ jsxs(View, { style: styles.linkRow, children: [
|
|
638
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => {
|
|
639
|
+
Linking.openURL(live).catch(() => void 0);
|
|
640
|
+
}, accessibilityRole: "link", accessibilityLabel: `Open ${displayHost(live)}`, style: [styles.link, {
|
|
641
|
+
borderColor: theme.border
|
|
642
|
+
}], pressedStyle: DIM, testID: "webbuilder-live", children: /* @__PURE__ */ jsx(Text, { style: [styles.linkText, {
|
|
643
|
+
color: theme.accent
|
|
644
|
+
}], numberOfLines: 1, children: displayHost(live) }) }),
|
|
645
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => copy(live), accessibilityRole: "button", accessibilityLabel: "Copy link", style: [styles.linkBtn, {
|
|
646
|
+
borderColor: theme.border
|
|
647
|
+
}], pressedStyle: DIM, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "content-copy", size: 18, color: theme.muted }) }),
|
|
648
|
+
/* @__PURE__ */ jsx(Tap, { onPress: () => {
|
|
649
|
+
Linking.openURL(live).catch(() => void 0);
|
|
650
|
+
}, accessibilityRole: "button", accessibilityLabel: "Open site", style: [styles.linkBtn, {
|
|
651
|
+
borderColor: theme.border
|
|
652
|
+
}], pressedStyle: DIM, children: /* @__PURE__ */ jsx(MaterialCommunityIcons, { name: "open-in-new", size: 18, color: theme.muted }) })
|
|
653
|
+
] }) : /* @__PURE__ */ jsx(Text, { style: [styles.note, {
|
|
654
|
+
color: theme.muted
|
|
655
|
+
}], children: "Put this site on the internet with its own address." }),
|
|
656
|
+
publishing && !starting ? /* @__PURE__ */ jsxs(View, { testID: "webbuilder-publishing", children: [
|
|
657
|
+
/* @__PURE__ */ jsx(PrimaryButton, { label: "Publishing\u2026", onPress: () => void 0, theme, busy: true }),
|
|
658
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
659
|
+
color: theme.muted
|
|
660
|
+
}], children: "This takes a minute or two. You can keep editing; the address appears here when it is live." })
|
|
661
|
+
] }) : /* @__PURE__ */ jsx(PrimaryButton, { label: publishPrimaryLabel(kind), icon: "rocket-launch-outline", onPress: primary, theme, busy: starting, disabled: !onPublish || Boolean(blocked), testID: "webbuilder-publish-primary" }),
|
|
662
|
+
blocked ? /* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
663
|
+
color: theme.muted
|
|
664
|
+
}], children: blocked }) : null,
|
|
665
|
+
error ? /* @__PURE__ */ jsx(Text, { style: [styles.help, {
|
|
666
|
+
color: theme.crit
|
|
667
|
+
}], children: error }) : null
|
|
668
|
+
] }),
|
|
669
|
+
tools ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
670
|
+
/* @__PURE__ */ jsx(Divider, { theme }),
|
|
671
|
+
/* @__PURE__ */ jsx(SectionTitle, { theme, children: "YOUR DOMAIN" }),
|
|
672
|
+
/* @__PURE__ */ jsx(MenuRow, { icon: "web", label: "Add your own domain", hint: "Use an address like www.yourname.com", onPress: () => setPage("domain"), theme, testID: "webbuilder-publish-domains" }),
|
|
673
|
+
/* @__PURE__ */ jsx(Divider, { theme }),
|
|
674
|
+
/* @__PURE__ */ jsx(MenuRow, { icon: "clipboard-check-outline", label: "Review site", hint: "Security, SEO and speed", onPress: () => setPage("review"), theme, trailing: null, testID: "webbuilder-publish-review" })
|
|
675
|
+
] }) : null,
|
|
676
|
+
onDownloadCode || onExport ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
677
|
+
/* @__PURE__ */ jsx(Divider, { theme }),
|
|
678
|
+
/* @__PURE__ */ jsx(MenuRow, { icon: "package-variant", label: "Export", hint: "Download the code or host it elsewhere", onPress: () => setExportOpen((v) => !v), theme, trailing: exportOpen ? "chevron-down" : "chevron-right", testID: "webbuilder-publish-export" }),
|
|
679
|
+
exportOpen ? /* @__PURE__ */ jsxs(View, { style: [styles.sub, {
|
|
680
|
+
borderLeftColor: theme.border
|
|
681
|
+
}], children: [
|
|
682
|
+
onDownloadCode ? /* @__PURE__ */ jsx(MenuRow, { icon: "download-outline", label: "Download code", hint: "ZIP + Dockerfile, ready to run", onPress: () => {
|
|
683
|
+
onClose();
|
|
684
|
+
onDownloadCode();
|
|
685
|
+
}, theme, trailing: null }) : null,
|
|
686
|
+
onExport ? EXPORT_TARGETS.map((t) => /* @__PURE__ */ jsx(MenuRow, { icon: t.target === "fly" ? "package-variant-closed" : "rocket-launch-outline", label: t.label, hint: t.hint, disabled: aiBusy, onPress: () => {
|
|
687
|
+
onClose();
|
|
688
|
+
onExport(t.target);
|
|
689
|
+
}, theme, trailing: null }, t.target)) : null,
|
|
690
|
+
onOwnCloudflare ? /* @__PURE__ */ jsx(MenuRow, { icon: "cloud-outline", label: "Publish to my Cloudflare", hint: "With your own Cloudflare account", disabled: aiBusy, onPress: () => {
|
|
691
|
+
onClose();
|
|
692
|
+
onOwnCloudflare();
|
|
693
|
+
}, theme, trailing: null, testID: "webbuilder-export-own-cloudflare" }) : null
|
|
694
|
+
] }) : null
|
|
695
|
+
] }) : null,
|
|
696
|
+
live && tools && liveName ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
697
|
+
/* @__PURE__ */ jsx(Divider, { theme }),
|
|
698
|
+
/* @__PURE__ */ jsx(MenuRow, { icon: "cloud-off-outline", label: unpublishing ? "Unpublishing\u2026" : "Unpublish", onPress: unpublish, disabled: unpublishing, danger: true, theme, trailing: null, testID: "webbuilder-publish-unpublish" })
|
|
699
|
+
] }) : null
|
|
89
700
|
] });
|
|
90
701
|
}
|
|
91
|
-
|
|
702
|
+
let title = "Publish";
|
|
703
|
+
if (page === "domain") title = "Your domain";
|
|
704
|
+
else if (page === "review") title = "Review site";
|
|
705
|
+
return /* @__PURE__ */ jsx(Sheet, { visible, title, onClose, theme, testID: "webbuilder-publish-sheet", children: body });
|
|
92
706
|
}
|
|
93
707
|
const styles = StyleSheet.create({
|
|
708
|
+
page: {
|
|
709
|
+
flexGrow: 0
|
|
710
|
+
},
|
|
711
|
+
pageBody: {
|
|
712
|
+
gap: 12,
|
|
713
|
+
paddingBottom: 12
|
|
714
|
+
},
|
|
715
|
+
menuBody: {
|
|
716
|
+
paddingBottom: 12
|
|
717
|
+
},
|
|
94
718
|
block: {
|
|
95
719
|
gap: 12,
|
|
96
720
|
paddingTop: 4
|
|
97
721
|
},
|
|
98
|
-
|
|
722
|
+
pill: {
|
|
99
723
|
flexDirection: "row",
|
|
100
|
-
|
|
724
|
+
alignItems: "center",
|
|
725
|
+
alignSelf: "flex-start",
|
|
726
|
+
gap: 6,
|
|
727
|
+
paddingHorizontal: 10,
|
|
728
|
+
paddingVertical: 4,
|
|
729
|
+
borderRadius: 999
|
|
101
730
|
},
|
|
102
|
-
|
|
731
|
+
pillDot: {
|
|
732
|
+
width: 6,
|
|
733
|
+
height: 6,
|
|
734
|
+
borderRadius: 3
|
|
735
|
+
},
|
|
736
|
+
pillText: {
|
|
737
|
+
fontSize: 13,
|
|
738
|
+
fontWeight: "600"
|
|
739
|
+
},
|
|
740
|
+
linkRow: {
|
|
103
741
|
flexDirection: "row",
|
|
104
742
|
alignItems: "center",
|
|
105
|
-
gap:
|
|
106
|
-
padding: 14,
|
|
107
|
-
borderRadius: 12
|
|
743
|
+
gap: 8
|
|
108
744
|
},
|
|
109
|
-
|
|
745
|
+
link: {
|
|
110
746
|
flex: 1,
|
|
747
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
748
|
+
borderRadius: 10,
|
|
749
|
+
paddingHorizontal: 12,
|
|
750
|
+
paddingVertical: 10
|
|
751
|
+
},
|
|
752
|
+
linkText: {
|
|
111
753
|
fontSize: 15,
|
|
112
|
-
fontWeight: "
|
|
754
|
+
fontWeight: "600"
|
|
113
755
|
},
|
|
114
|
-
|
|
756
|
+
linkBtn: {
|
|
757
|
+
width: 42,
|
|
758
|
+
height: 42,
|
|
759
|
+
borderRadius: 10,
|
|
760
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
761
|
+
alignItems: "center",
|
|
762
|
+
justifyContent: "center"
|
|
763
|
+
},
|
|
764
|
+
section: {
|
|
765
|
+
fontSize: 12,
|
|
766
|
+
fontWeight: "700",
|
|
767
|
+
letterSpacing: 0.6,
|
|
768
|
+
paddingTop: 12,
|
|
769
|
+
paddingBottom: 2
|
|
770
|
+
},
|
|
771
|
+
row: {
|
|
772
|
+
flexDirection: "row",
|
|
773
|
+
alignItems: "center",
|
|
774
|
+
gap: 12,
|
|
775
|
+
paddingVertical: 12,
|
|
776
|
+
minHeight: 52
|
|
777
|
+
},
|
|
778
|
+
rowText: {
|
|
779
|
+
flex: 1
|
|
780
|
+
},
|
|
781
|
+
rowLabel: {
|
|
782
|
+
fontSize: 16,
|
|
783
|
+
fontWeight: "500"
|
|
784
|
+
},
|
|
785
|
+
rowHint: {
|
|
115
786
|
fontSize: 13,
|
|
787
|
+
marginTop: 2
|
|
788
|
+
},
|
|
789
|
+
sub: {
|
|
790
|
+
marginLeft: 10,
|
|
791
|
+
paddingLeft: 12,
|
|
792
|
+
borderLeftWidth: StyleSheet.hairlineWidth
|
|
793
|
+
},
|
|
794
|
+
divider: {
|
|
795
|
+
height: StyleSheet.hairlineWidth,
|
|
796
|
+
marginTop: 8
|
|
797
|
+
},
|
|
798
|
+
disabled: {
|
|
799
|
+
opacity: 0.4
|
|
800
|
+
},
|
|
801
|
+
back: {
|
|
802
|
+
flexDirection: "row",
|
|
803
|
+
alignItems: "center",
|
|
804
|
+
gap: 2,
|
|
805
|
+
alignSelf: "flex-start",
|
|
806
|
+
paddingVertical: 4
|
|
807
|
+
},
|
|
808
|
+
backText: {
|
|
809
|
+
fontSize: 15,
|
|
810
|
+
fontWeight: "600"
|
|
811
|
+
},
|
|
812
|
+
label: {
|
|
813
|
+
fontSize: 14,
|
|
116
814
|
fontWeight: "600",
|
|
117
815
|
marginTop: 4
|
|
118
816
|
},
|
|
119
817
|
field: {
|
|
120
|
-
flexDirection: "row",
|
|
121
|
-
alignItems: "center",
|
|
122
818
|
borderRadius: 12,
|
|
123
|
-
borderWidth:
|
|
819
|
+
borderWidth: 1.5,
|
|
124
820
|
paddingHorizontal: 14,
|
|
125
821
|
minHeight: 48
|
|
126
822
|
},
|
|
823
|
+
nameField: {
|
|
824
|
+
flexDirection: "row",
|
|
825
|
+
alignItems: "center",
|
|
826
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
827
|
+
},
|
|
127
828
|
input: {
|
|
128
829
|
flex: 1,
|
|
129
830
|
fontSize: 16,
|
|
@@ -133,11 +834,166 @@ const styles = StyleSheet.create({
|
|
|
133
834
|
fontSize: 15
|
|
134
835
|
},
|
|
135
836
|
help: {
|
|
136
|
-
fontSize: 13
|
|
837
|
+
fontSize: 13,
|
|
838
|
+
lineHeight: 18
|
|
137
839
|
},
|
|
138
840
|
note: {
|
|
139
841
|
fontSize: 14,
|
|
140
|
-
lineHeight: 20
|
|
141
|
-
|
|
842
|
+
lineHeight: 20
|
|
843
|
+
},
|
|
844
|
+
center: {
|
|
845
|
+
textAlign: "center"
|
|
846
|
+
},
|
|
847
|
+
steps: {
|
|
848
|
+
flexDirection: "row",
|
|
849
|
+
gap: 10,
|
|
850
|
+
paddingVertical: 4
|
|
851
|
+
},
|
|
852
|
+
step: {
|
|
853
|
+
flex: 1,
|
|
854
|
+
flexDirection: "row",
|
|
855
|
+
alignItems: "center",
|
|
856
|
+
gap: 8
|
|
857
|
+
},
|
|
858
|
+
stepDot: {
|
|
859
|
+
width: 24,
|
|
860
|
+
height: 24,
|
|
861
|
+
borderRadius: 12,
|
|
862
|
+
borderWidth: 1.5,
|
|
863
|
+
alignItems: "center",
|
|
864
|
+
justifyContent: "center"
|
|
865
|
+
},
|
|
866
|
+
stepNum: {
|
|
867
|
+
fontSize: 12,
|
|
868
|
+
fontWeight: "700"
|
|
869
|
+
},
|
|
870
|
+
stepLabel: {
|
|
871
|
+
flex: 1,
|
|
872
|
+
fontSize: 13,
|
|
873
|
+
lineHeight: 17
|
|
874
|
+
},
|
|
875
|
+
domainHead: {
|
|
876
|
+
flexDirection: "row",
|
|
877
|
+
alignItems: "center",
|
|
878
|
+
gap: 8
|
|
879
|
+
},
|
|
880
|
+
domainName: {
|
|
881
|
+
flex: 1,
|
|
882
|
+
fontSize: 17,
|
|
883
|
+
fontWeight: "700"
|
|
884
|
+
},
|
|
885
|
+
record: {
|
|
886
|
+
gap: 8,
|
|
887
|
+
padding: 12,
|
|
888
|
+
borderRadius: 12,
|
|
889
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
890
|
+
},
|
|
891
|
+
recordHead: {
|
|
892
|
+
flexDirection: "row",
|
|
893
|
+
alignItems: "center",
|
|
894
|
+
gap: 10
|
|
895
|
+
},
|
|
896
|
+
recordType: {
|
|
897
|
+
fontSize: 12,
|
|
898
|
+
fontWeight: "700",
|
|
899
|
+
paddingHorizontal: 8,
|
|
900
|
+
paddingVertical: 2,
|
|
901
|
+
borderRadius: 6,
|
|
902
|
+
overflow: "hidden"
|
|
903
|
+
},
|
|
904
|
+
recordField: {
|
|
905
|
+
flexDirection: "row",
|
|
906
|
+
alignItems: "center",
|
|
907
|
+
gap: 10
|
|
908
|
+
},
|
|
909
|
+
mono: {
|
|
910
|
+
fontSize: 14,
|
|
911
|
+
fontFamily: "Menlo",
|
|
912
|
+
marginTop: 2
|
|
913
|
+
},
|
|
914
|
+
chips: {
|
|
915
|
+
flexDirection: "row",
|
|
916
|
+
flexWrap: "wrap",
|
|
917
|
+
gap: 8
|
|
918
|
+
},
|
|
919
|
+
chip: {
|
|
920
|
+
paddingHorizontal: 12,
|
|
921
|
+
paddingVertical: 7,
|
|
922
|
+
borderRadius: 999,
|
|
923
|
+
borderWidth: 1
|
|
924
|
+
},
|
|
925
|
+
chipText: {
|
|
926
|
+
fontSize: 14,
|
|
927
|
+
fontWeight: "500"
|
|
928
|
+
},
|
|
929
|
+
reviewHead: {
|
|
930
|
+
flexDirection: "row",
|
|
931
|
+
alignItems: "center",
|
|
932
|
+
justifyContent: "space-between"
|
|
933
|
+
},
|
|
934
|
+
tabs: {
|
|
935
|
+
flexDirection: "row",
|
|
936
|
+
gap: 6,
|
|
937
|
+
paddingVertical: 8,
|
|
938
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
939
|
+
marginBottom: 8
|
|
940
|
+
},
|
|
941
|
+
tab: {
|
|
942
|
+
flexDirection: "row",
|
|
943
|
+
alignItems: "center",
|
|
944
|
+
gap: 6,
|
|
945
|
+
paddingHorizontal: 12,
|
|
946
|
+
paddingVertical: 8,
|
|
947
|
+
borderRadius: 10
|
|
948
|
+
},
|
|
949
|
+
tabText: {
|
|
950
|
+
fontSize: 14,
|
|
951
|
+
fontWeight: "600"
|
|
952
|
+
},
|
|
953
|
+
spin: {
|
|
954
|
+
paddingVertical: 24
|
|
955
|
+
},
|
|
956
|
+
empty: {
|
|
957
|
+
alignItems: "center",
|
|
958
|
+
gap: 8,
|
|
959
|
+
paddingVertical: 28,
|
|
960
|
+
paddingHorizontal: 12
|
|
961
|
+
},
|
|
962
|
+
emptyTitle: {
|
|
963
|
+
fontSize: 16,
|
|
964
|
+
fontWeight: "700",
|
|
965
|
+
textAlign: "center"
|
|
966
|
+
},
|
|
967
|
+
finding: {
|
|
968
|
+
gap: 8,
|
|
969
|
+
padding: 12,
|
|
970
|
+
borderRadius: 12,
|
|
971
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
972
|
+
},
|
|
973
|
+
findingHead: {
|
|
974
|
+
flexDirection: "row",
|
|
975
|
+
alignItems: "center",
|
|
976
|
+
gap: 10
|
|
977
|
+
},
|
|
978
|
+
badges: {
|
|
979
|
+
flexDirection: "row",
|
|
980
|
+
flexWrap: "wrap",
|
|
981
|
+
gap: 10
|
|
982
|
+
},
|
|
983
|
+
badge: {
|
|
984
|
+
minWidth: 90,
|
|
985
|
+
alignItems: "center",
|
|
986
|
+
paddingVertical: 10,
|
|
987
|
+
paddingHorizontal: 12,
|
|
988
|
+
borderRadius: 12,
|
|
989
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
990
|
+
},
|
|
991
|
+
badgeValue: {
|
|
992
|
+
fontSize: 22,
|
|
993
|
+
fontWeight: "800"
|
|
994
|
+
},
|
|
995
|
+
footer: {
|
|
996
|
+
paddingTop: 10,
|
|
997
|
+
borderTopWidth: StyleSheet.hairlineWidth
|
|
142
998
|
}
|
|
143
999
|
});export{PublishSheet};//# sourceMappingURL=PublishSheet.js.map
|