@netlify/spark-ui 1.31.0-alpha.3 → 1.31.0-alpha.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/dist/components/index.d.ts +2 -2
- package/dist/components/preact/DropZone/DropZone.d.ts +27 -9
- package/dist/components/preact/DropZone/DropZone.js +59 -54
- package/dist/components/preact/DropZone/DropZone.test.d.ts +1 -0
- package/dist/components/preact/DropZone/index.d.ts +3 -3
- package/dist/components/preact/DropZone/index.js +29 -27
- package/dist/components/preact/DropZone/useDropDeploy.d.ts +9 -6
- package/dist/components/preact/DropZone/useDropDeploy.js +182 -131
- package/dist/components/preact/DropZone/useDropDeploy.test.d.ts +1 -0
- package/dist/components/preact/index.d.ts +2 -2
- package/dist/components/preact/index.js +24 -18
- package/dist/drop-core/analytics.d.ts +107 -0
- package/dist/drop-core/analytics.js +21 -0
- package/dist/drop-core/analytics.test.d.ts +1 -0
- package/dist/drop-core/authedApi.d.ts +45 -0
- package/dist/drop-core/authedApi.js +30 -0
- package/dist/drop-core/authedApi.test.d.ts +1 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/authedDropClient.d.ts +4 -11
- package/dist/drop-core/authedDropClient.js +100 -0
- package/dist/drop-core/authedDropClient.test.d.ts +1 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/buildClient.d.ts +5 -13
- package/dist/drop-core/buildClient.js +85 -0
- package/dist/drop-core/buildClient.test.d.ts +1 -0
- package/dist/drop-core/buildStash.d.ts +37 -0
- package/dist/drop-core/buildStash.js +84 -0
- package/dist/drop-core/buildStash.test.d.ts +0 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/client.d.ts +3 -1
- package/dist/drop-core/client.js +47 -0
- package/dist/drop-core/constants.d.ts +29 -0
- package/dist/drop-core/constants.js +10 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/deploy.d.ts +9 -0
- package/dist/drop-core/deploy.js +66 -0
- package/dist/drop-core/deploy.test.d.ts +1 -0
- package/dist/drop-core/detectBuild.test.d.ts +1 -0
- package/dist/drop-core/digest.test.d.ts +1 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/errors.d.ts +29 -0
- package/dist/drop-core/errors.js +119 -0
- package/dist/drop-core/errors.test.d.ts +1 -0
- package/dist/drop-core/fileTypes.test.d.ts +1 -0
- package/dist/drop-core/index.d.ts +25 -0
- package/dist/drop-core/index.js +47 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/readFiles.js +2 -2
- package/dist/drop-core/readFiles.test.d.ts +1 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/types.d.ts +10 -0
- package/dist/{components/preact/DropZone/drop-core → drop-core}/zip.js +1 -1
- package/dist/drop-core/zip.test.d.ts +1 -0
- package/package.json +4 -1
- package/packages/components/index.ts +19 -0
- package/packages/components/preact/DropZone/DropZone.test.ts +71 -0
- package/packages/components/preact/DropZone/DropZone.tsx +29 -9
- package/packages/components/preact/DropZone/index.tsx +14 -3
- package/packages/components/preact/DropZone/useDropDeploy.test.ts +376 -0
- package/packages/components/preact/DropZone/useDropDeploy.ts +301 -145
- package/packages/components/preact/index.ts +19 -2
- package/packages/drop-core/README.md +91 -0
- package/packages/drop-core/analytics.test.ts +17 -0
- package/packages/drop-core/analytics.ts +122 -0
- package/packages/drop-core/authedApi.test.ts +100 -0
- package/packages/drop-core/authedApi.ts +81 -0
- package/packages/drop-core/authedDropClient.test.ts +196 -0
- package/packages/{components/preact/DropZone/drop-core → drop-core}/authedDropClient.ts +30 -72
- package/packages/drop-core/buildClient.test.ts +112 -0
- package/packages/{components/preact/DropZone/drop-core → drop-core}/buildClient.ts +27 -57
- package/packages/drop-core/buildStash.test.ts +85 -0
- package/packages/drop-core/buildStash.ts +185 -0
- package/packages/{components/preact/DropZone/drop-core → drop-core}/client.ts +18 -6
- package/packages/drop-core/constants.ts +39 -0
- package/packages/drop-core/deploy.test.ts +177 -0
- package/packages/{components/preact/DropZone/drop-core → drop-core}/deploy.ts +59 -9
- package/packages/drop-core/detectBuild.test.ts +139 -0
- package/packages/drop-core/digest.test.ts +24 -0
- package/packages/drop-core/errors.test.ts +98 -0
- package/packages/{components/preact/DropZone/drop-core → drop-core}/errors.ts +68 -11
- package/packages/drop-core/fileTypes.test.ts +37 -0
- package/packages/drop-core/index.ts +44 -0
- package/packages/drop-core/readFiles.test.ts +124 -0
- package/packages/{components/preact/DropZone/drop-core → drop-core}/types.ts +12 -6
- package/packages/drop-core/zip.test.ts +92 -0
- package/dist/components/preact/DropZone/drop-core/authedDropClient.js +0 -123
- package/dist/components/preact/DropZone/drop-core/buildClient.js +0 -99
- package/dist/components/preact/DropZone/drop-core/client.js +0 -45
- package/dist/components/preact/DropZone/drop-core/deploy.js +0 -48
- package/dist/components/preact/DropZone/drop-core/errors.js +0 -82
- package/dist/components/preact/DropZone/drop-core/index.d.ts +0 -11
- package/dist/components/preact/DropZone/drop-core/index.js +0 -36
- package/packages/components/preact/DropZone/drop-core/index.ts +0 -11
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/detectBuild.d.ts +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/detectBuild.js +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/digest.d.ts +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/digest.js +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/fileTypes.d.ts +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/fileTypes.js +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/readFiles.d.ts +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/types.js +0 -0
- /package/dist/{components/preact/DropZone/drop-core → drop-core}/zip.d.ts +0 -0
- /package/packages/{components/preact/DropZone/drop-core → drop-core}/detectBuild.ts +0 -0
- /package/packages/{components/preact/DropZone/drop-core → drop-core}/digest.ts +0 -0
- /package/packages/{components/preact/DropZone/drop-core → drop-core}/fileTypes.ts +0 -0
- /package/packages/{components/preact/DropZone/drop-core → drop-core}/readFiles.ts +0 -0
- /package/packages/{components/preact/DropZone/drop-core → drop-core}/zip.ts +0 -0
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { d as R, A as S, y as nt } from "../../../chunks/hooks.module.DRcxknIz.js";
|
|
2
|
+
import { humanizeDropError as rt, isNotAuthenticatedError as O } from "../../../drop-core/errors.js";
|
|
3
|
+
import { DROPZONE_EVENTS as c } from "../../../drop-core/analytics.js";
|
|
4
|
+
import { renameSingleNonIndexHtmlToIndex as at, getSingleNonIndexHtmlFileName as ot, hasMultipleHtmlFilesWithoutIndex as st } from "../../../drop-core/readFiles.js";
|
|
5
|
+
import { detectBuild as dt } from "../../../drop-core/detectBuild.js";
|
|
6
|
+
import { zipFiles as lt } from "../../../drop-core/zip.js";
|
|
7
|
+
import { AnonymousDropClient as ut } from "../../../drop-core/client.js";
|
|
8
|
+
import { AuthenticatedDropClient as ct } from "../../../drop-core/authedDropClient.js";
|
|
9
|
+
import { AuthenticatedBuildClient as mt } from "../../../drop-core/buildClient.js";
|
|
10
|
+
import { deployZippedBuild as ft, deployFiles as v } from "../../../drop-core/deploy.js";
|
|
11
|
+
import { hasDropStashMarker as gt, loadDropStash as ht, clearDropStash as E, saveDropStash as pt } from "../../../drop-core/buildStash.js";
|
|
12
|
+
function I(l) {
|
|
13
|
+
switch (l.phase) {
|
|
12
14
|
case "zipping":
|
|
13
15
|
return { kind: "zipping" };
|
|
14
16
|
case "creating":
|
|
15
17
|
return { kind: "creating" };
|
|
16
18
|
case "uploading":
|
|
17
|
-
return { kind: "uploading", uploaded:
|
|
19
|
+
return { kind: "uploading", uploaded: l.uploaded ?? 0, total: l.total ?? 0 };
|
|
18
20
|
case "building":
|
|
19
21
|
return { kind: "building" };
|
|
20
22
|
case "processing":
|
|
@@ -22,143 +24,192 @@ function S(o) {
|
|
|
22
24
|
return { kind: "processing" };
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
return
|
|
27
|
+
function wt(l) {
|
|
28
|
+
const m = ot(l);
|
|
29
|
+
return m ? `No index.html found — "${m}" won’t be served at the site root.` : st(l) ? "No index.html found — your site may not have a landing page." : null;
|
|
28
30
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
function St(l, m) {
|
|
32
|
+
try {
|
|
33
|
+
localStorage.setItem("drop-token", l), localStorage.setItem("dropSiteName", m);
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function Pt({
|
|
38
|
+
apiBase: l,
|
|
39
|
+
client: m,
|
|
40
|
+
claimUrl: z,
|
|
41
|
+
siteDashboardUrl: H,
|
|
42
|
+
buildSignupUrl: W,
|
|
43
|
+
buildClient: Y,
|
|
44
|
+
authenticatedDropClient: M,
|
|
45
|
+
getUploadToken: p,
|
|
46
|
+
proxyBase: N,
|
|
47
|
+
accountSlug: A,
|
|
48
|
+
buildDeployUrl: C,
|
|
49
|
+
waitForBuild: Z,
|
|
50
|
+
onBuildRequired: L,
|
|
51
|
+
onBuildSignupHandoff: P,
|
|
52
|
+
resumeStashedBuilds: $ = !0,
|
|
53
|
+
onDeploy: k,
|
|
54
|
+
onBuildDeploy: f,
|
|
55
|
+
onError: g,
|
|
56
|
+
track: q
|
|
47
57
|
}) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
const u = (n, t) => (
|
|
59
|
+
// The event interfaces carry no index signature, hence the cast to TrackFn's record.
|
|
60
|
+
q(n, t)
|
|
61
|
+
), [b, a] = R({ kind: "idle" }), [U, _] = R(null), j = S(m ?? new ut(l)).current, w = S(
|
|
62
|
+
Y ?? (p ? new mt({ proxyBase: N, getUploadToken: p, accountSlug: A }) : null)
|
|
63
|
+
).current, y = S(
|
|
64
|
+
M ?? (p ? new ct({ proxyBase: N, getUploadToken: p, accountSlug: A }) : null)
|
|
65
|
+
).current, J = b.kind !== "idle" && b.kind !== "error";
|
|
66
|
+
async function x(n, t) {
|
|
54
67
|
try {
|
|
55
|
-
const { site:
|
|
56
|
-
onProgress: (
|
|
57
|
-
waitForBuild:
|
|
68
|
+
const { site: i, build: r, buildSettings: o, url: e } = await ft(n, t, {
|
|
69
|
+
onProgress: (s) => a(I(s)),
|
|
70
|
+
waitForBuild: Z
|
|
58
71
|
});
|
|
59
72
|
return {
|
|
60
|
-
url:
|
|
61
|
-
siteName:
|
|
62
|
-
siteId:
|
|
63
|
-
buildId:
|
|
64
|
-
deployId:
|
|
65
|
-
buildSettings:
|
|
73
|
+
url: e,
|
|
74
|
+
siteName: i.name,
|
|
75
|
+
siteId: i.id,
|
|
76
|
+
buildId: r.id,
|
|
77
|
+
deployId: r.deploy_id,
|
|
78
|
+
buildSettings: o
|
|
66
79
|
};
|
|
67
|
-
} catch (
|
|
68
|
-
if (
|
|
69
|
-
throw
|
|
80
|
+
} catch (i) {
|
|
81
|
+
if (O(i)) return null;
|
|
82
|
+
throw i;
|
|
70
83
|
}
|
|
71
84
|
}
|
|
72
|
-
async function
|
|
73
|
-
_(null),
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
}, k = (t, i) => {
|
|
77
|
-
const a = t instanceof Error ? t.message : String(t);
|
|
78
|
-
g(nt(t), a, i);
|
|
85
|
+
async function Q(n, t, i) {
|
|
86
|
+
_(null), a({ kind: "reading" });
|
|
87
|
+
const r = i.length ? { file_types: i } : {}, o = (e, s, d) => {
|
|
88
|
+
a({ kind: "error", message: e }), u(c.DEPLOY_FAILED, { method: t, reason: s, ...r, ...d }), g == null || g({ message: e, reason: s });
|
|
79
89
|
};
|
|
80
90
|
try {
|
|
81
|
-
const
|
|
82
|
-
if (!
|
|
83
|
-
|
|
91
|
+
const e = at(await n());
|
|
92
|
+
if (!e.length) {
|
|
93
|
+
o("No files found to deploy.", "No files found to deploy.", { file_count: 0 });
|
|
84
94
|
return;
|
|
85
95
|
}
|
|
86
|
-
|
|
87
|
-
method:
|
|
88
|
-
file_count:
|
|
89
|
-
...
|
|
96
|
+
t === "drag" && u(c.FILES_DROPPED, {
|
|
97
|
+
method: t,
|
|
98
|
+
file_count: e.length,
|
|
99
|
+
...r
|
|
90
100
|
});
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
101
|
+
const s = { source: t, fileCount: e.length, typeProps: r }, d = dt(e);
|
|
102
|
+
d.buildRequired ? await T(e, d, s) : await G(e, s);
|
|
103
|
+
} catch (e) {
|
|
104
|
+
const s = e instanceof Error ? e.message : String(e);
|
|
105
|
+
o(rt(e), s);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function T(n, t, { source: i, fileCount: r, typeProps: o }) {
|
|
109
|
+
if (u(c.BUILD_REQUIRED, {
|
|
110
|
+
method: i,
|
|
111
|
+
reason: t.reason,
|
|
112
|
+
file_count: r,
|
|
113
|
+
...o
|
|
114
|
+
}), L) {
|
|
115
|
+
a({ kind: "idle" }), L(t);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let e = !1;
|
|
119
|
+
if (w) {
|
|
120
|
+
a({ kind: "zipping" });
|
|
121
|
+
const s = await lt(n), d = await x(w, s);
|
|
122
|
+
if (d) {
|
|
123
|
+
a({ kind: "redirecting", target: "build" }), u(c.BUILD_DEPLOY_SUCCEEDED, {
|
|
124
|
+
method: i,
|
|
125
|
+
reason: t.reason,
|
|
126
|
+
site_name: d.siteName,
|
|
127
|
+
file_count: r,
|
|
128
|
+
...d.buildSettings ? { framework: d.buildSettings.framework } : {},
|
|
129
|
+
...o
|
|
130
|
+
}), f == null || f(d), window.location.assign(C(d));
|
|
117
131
|
return;
|
|
118
132
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
a || (a = await W(L, t, {
|
|
131
|
-
onProgress: (e) => n(S(e))
|
|
132
|
-
}));
|
|
133
|
-
const { url: X, token: N, deploy: u } = a;
|
|
134
|
-
if (!s)
|
|
135
|
-
try {
|
|
136
|
-
localStorage.setItem("drop-token", N), localStorage.setItem("dropSiteName", u.subdomain);
|
|
137
|
-
} catch {
|
|
138
|
-
}
|
|
139
|
-
n({ kind: "redirecting", target: s ? "dashboard" : "claim" }), c("dropzone_deploy_succeeded", {
|
|
140
|
-
method: r,
|
|
141
|
-
site_name: u.subdomain,
|
|
142
|
-
file_count: t.length,
|
|
143
|
-
authenticated: s,
|
|
144
|
-
...P ? { auth_fallback: !0 } : {},
|
|
145
|
-
...l
|
|
146
|
-
}), p == null || p({
|
|
147
|
-
url: X,
|
|
148
|
-
...s ? {} : { token: N },
|
|
149
|
-
siteName: u.subdomain,
|
|
150
|
-
siteId: u.id,
|
|
151
|
-
authenticated: s
|
|
152
|
-
}), s ? window.location.assign(j(u.subdomain)) : window.location.assign(`${v(u.subdomain)}#drop_token=${N}`);
|
|
153
|
-
} catch (t) {
|
|
154
|
-
k(t);
|
|
133
|
+
e = await pt(s.file, s.buildSettings), e && u(c.PROJECT_STASHED, {
|
|
134
|
+
method: i,
|
|
135
|
+
reason: t.reason,
|
|
136
|
+
file_count: r,
|
|
137
|
+
...o
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (P) {
|
|
141
|
+
a({ kind: "idle" }), P({ stashed: e, detection: t });
|
|
142
|
+
return;
|
|
155
143
|
}
|
|
144
|
+
a({ kind: "redirecting", target: "signup" }), window.location.assign(W);
|
|
145
|
+
}
|
|
146
|
+
async function V(n, t) {
|
|
147
|
+
try {
|
|
148
|
+
return await v(n, t, {
|
|
149
|
+
onProgress: (i) => a(I(i))
|
|
150
|
+
});
|
|
151
|
+
} catch (i) {
|
|
152
|
+
if (O(i)) return null;
|
|
153
|
+
throw i;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function G(n, { source: t, fileCount: i, typeProps: r }) {
|
|
157
|
+
_(wt(n));
|
|
158
|
+
const o = y ? await V(y, n) : null, e = o !== null, s = y !== null && !e, d = o ?? await v(j, n, {
|
|
159
|
+
onProgress: (it) => a(I(it))
|
|
160
|
+
}), { url: et, token: D, deploy: h } = d;
|
|
161
|
+
e || St(D, h.subdomain), a({ kind: "redirecting", target: e ? "dashboard" : "claim" }), u(c.DEPLOY_SUCCEEDED, {
|
|
162
|
+
method: t,
|
|
163
|
+
site_name: h.subdomain,
|
|
164
|
+
file_count: i,
|
|
165
|
+
authenticated: e,
|
|
166
|
+
...s ? { auth_fallback: !0 } : {},
|
|
167
|
+
...r
|
|
168
|
+
}), k == null || k({
|
|
169
|
+
url: et,
|
|
170
|
+
...e ? {} : { token: D },
|
|
171
|
+
siteName: h.subdomain,
|
|
172
|
+
siteId: h.id,
|
|
173
|
+
authenticated: e
|
|
174
|
+
}), K(e, h.subdomain, D);
|
|
175
|
+
}
|
|
176
|
+
function K(n, t, i) {
|
|
177
|
+
n ? window.location.assign(H(t)) : window.location.assign(`${z(t)}#drop_token=${i}`);
|
|
178
|
+
}
|
|
179
|
+
async function X(n) {
|
|
180
|
+
const t = await ht();
|
|
181
|
+
if (!t) {
|
|
182
|
+
await E();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
u(c.RESUMED, {}), a({ kind: "creating" });
|
|
186
|
+
const i = { file: t.zipFile, buildSettings: t.buildSettings };
|
|
187
|
+
let r;
|
|
188
|
+
try {
|
|
189
|
+
r = await x(n, i);
|
|
190
|
+
} catch (o) {
|
|
191
|
+
await E(), B(o instanceof Error ? o.message : String(o));
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (!r) {
|
|
195
|
+
a({ kind: "idle" });
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
await E(), a({ kind: "redirecting", target: "build" }), f == null || f(r), window.location.assign(C(r));
|
|
199
|
+
}
|
|
200
|
+
function B(n) {
|
|
201
|
+
const t = "We couldn’t automatically deploy your project. Drop it again to publish it.";
|
|
202
|
+
a({ kind: "error", message: t }), u(c.DEPLOY_FAILED, { reason: "resume_failed" }), g == null || g({ message: t, reason: n });
|
|
156
203
|
}
|
|
157
|
-
|
|
158
|
-
|
|
204
|
+
const F = S(!1);
|
|
205
|
+
nt(() => {
|
|
206
|
+
F.current || !$ || !w || !gt() || (F.current = !0, X(w));
|
|
207
|
+
}, []);
|
|
208
|
+
function tt() {
|
|
209
|
+
_(null), a({ kind: "idle" });
|
|
159
210
|
}
|
|
160
|
-
return { status:
|
|
211
|
+
return { status: b, warning: U, busy: J, deploy: Q, reset: tt };
|
|
161
212
|
}
|
|
162
213
|
export {
|
|
163
|
-
|
|
214
|
+
Pt as useDropDeploy
|
|
164
215
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,6 +6,6 @@ export { default as SearchHeading } from './SearchModal/components/SearchHeading
|
|
|
6
6
|
export { default as SearchToggle } from './SearchModal/components/SearchToggle/SearchToggle';
|
|
7
7
|
export { default as AskNetlify } from './AskNetlify/AskNetlify';
|
|
8
8
|
export { SearchModal } from './SearchModal';
|
|
9
|
-
export { DropZone, AuthenticatedBuildClient, AuthenticatedDropClient } from './DropZone';
|
|
10
|
-
export type { BuildClient, DeployedBuild, DeployedSite, DropClient } from './DropZone';
|
|
9
|
+
export { DropZone, AuthenticatedBuildClient, AuthenticatedDropClient, DROPZONE_EVENTS, getFileTypes, humanizeDropError, } from './DropZone';
|
|
10
|
+
export type { BuildClient, DeployedBuild, DeployedSite, DeployError, DeployStatus, DropClient, DropZoneEventName, DropZoneEventProperties, TrackFn, } from './DropZone';
|
|
11
11
|
export { type IconName } from './Icon';
|
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
import { default as m } from "./KeyboardKey/KeyboardKey.js";
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
2
|
+
import { default as d } from "./Modal/Modal.js";
|
|
3
|
+
import { default as x } from "./Icon/index.js";
|
|
4
4
|
import { default as s } from "./SearchModal/components/SearchLink/SearchLink.js";
|
|
5
5
|
import { default as c } from "./SearchModal/components/SearchHeading/SearchHeading.js";
|
|
6
|
-
import { default as
|
|
7
|
-
import { A as
|
|
6
|
+
import { default as S } from "./SearchModal/components/SearchToggle/SearchToggle.js";
|
|
7
|
+
import { A as y } from "../../chunks/AskNetlify.bx0blyGV.js";
|
|
8
8
|
import "preact";
|
|
9
9
|
import "../../chunks/hooks.module.DRcxknIz.js";
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as
|
|
12
|
-
import "
|
|
13
|
-
import "
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import "
|
|
10
|
+
import { default as D } from "./SearchModal/components/SearchModal/SearchModal.js";
|
|
11
|
+
import { default as N } from "./DropZone/DropZone.js";
|
|
12
|
+
import { humanizeDropError as k } from "../../drop-core/errors.js";
|
|
13
|
+
import { DROPZONE_EVENTS as K } from "../../drop-core/analytics.js";
|
|
14
|
+
import "../../drop-core/readFiles.js";
|
|
15
|
+
import { getFileTypes as O } from "../../drop-core/fileTypes.js";
|
|
16
|
+
import "../../drop-core/detectBuild.js";
|
|
17
|
+
import "../../drop-core/zip.js";
|
|
18
|
+
import { AuthenticatedDropClient as b } from "../../drop-core/authedDropClient.js";
|
|
19
|
+
import { AuthenticatedBuildClient as B } from "../../drop-core/buildClient.js";
|
|
17
20
|
export {
|
|
18
|
-
|
|
21
|
+
y as AskNetlify,
|
|
19
22
|
B as AuthenticatedBuildClient,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
b as AuthenticatedDropClient,
|
|
24
|
+
K as DROPZONE_EVENTS,
|
|
25
|
+
N as DropZone,
|
|
26
|
+
x as Icon,
|
|
23
27
|
m as KeyboardKey,
|
|
24
|
-
|
|
28
|
+
d as Modal,
|
|
25
29
|
c as SearchHeading,
|
|
26
30
|
s as SearchLink,
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
D as SearchModal,
|
|
32
|
+
S as SearchToggle,
|
|
33
|
+
O as getFileTypes,
|
|
34
|
+
k as humanizeDropError
|
|
29
35
|
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { BuildReason } from './detectBuild';
|
|
2
|
+
/**
|
|
3
|
+
* The Drop Zone's analytics contract — the canonical event names and property
|
|
4
|
+
* shapes, exported so no consumer (this package's own component, a host site's
|
|
5
|
+
* GTM wiring, or another Netlify surface implementing its own Drop UI over
|
|
6
|
+
* drop-core) ever hand-writes the strings.
|
|
7
|
+
*/
|
|
8
|
+
/** How the files reached the zone — carried on every drop-initiated event as `method`. */
|
|
9
|
+
export type DropMethod = 'drag' | 'browse';
|
|
10
|
+
/**
|
|
11
|
+
* Canonical Drop Zone lifecycle events. The values are the wire names:
|
|
12
|
+
* analytics history in Amplitude/Segment keys off these exact strings, so
|
|
13
|
+
* renaming a value silently forks every funnel built on it — treat them as
|
|
14
|
+
* append-only.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DROPZONE_EVENTS: {
|
|
17
|
+
/** Files arrived via drag — the picker path reports its files on outcome events instead. */
|
|
18
|
+
readonly FILES_DROPPED: "dropzone_files_dropped";
|
|
19
|
+
/** The native file picker was opened (keyboard or click). */
|
|
20
|
+
readonly BROWSE_OPENED: "dropzone_browse_opened";
|
|
21
|
+
/** The drop needs a build — it will be built in place, stashed, or handed off. */
|
|
22
|
+
readonly BUILD_REQUIRED: "dropzone_build_required";
|
|
23
|
+
/** A static deploy went live (anonymous or into the visitor's account). */
|
|
24
|
+
readonly DEPLOY_SUCCEEDED: "dropzone_deploy_succeeded";
|
|
25
|
+
/** A build was enqueued in the visitor's account. */
|
|
26
|
+
readonly BUILD_DEPLOY_SUCCEEDED: "dropzone_build_deploy_succeeded";
|
|
27
|
+
/** Any attempt ended in an error (including a failed resume). */
|
|
28
|
+
readonly DEPLOY_FAILED: "dropzone_deploy_failed";
|
|
29
|
+
/** A logged-out build drop was stashed locally before the signup hand-off. */
|
|
30
|
+
readonly PROJECT_STASHED: "dropzone_project_stashed";
|
|
31
|
+
/** A stashed build drop was picked up for automatic deployment. */
|
|
32
|
+
readonly RESUMED: "dropzone_resumed";
|
|
33
|
+
};
|
|
34
|
+
export type DropZoneEventName = (typeof DROPZONE_EVENTS)[keyof typeof DROPZONE_EVENTS];
|
|
35
|
+
/** Properties the component adds to every event. */
|
|
36
|
+
export interface DropZoneBaseEventProps {
|
|
37
|
+
/** Present when the consumer sets `analyticsId` — tells multiple zones apart. */
|
|
38
|
+
dropzone_id?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface FilesDroppedProps extends DropZoneBaseEventProps {
|
|
41
|
+
method: 'drag';
|
|
42
|
+
file_count: number;
|
|
43
|
+
/** Omitted — never `[]` — when the browser exposes no files. */
|
|
44
|
+
file_types?: string[];
|
|
45
|
+
}
|
|
46
|
+
export interface BrowseOpenedProps extends DropZoneBaseEventProps {
|
|
47
|
+
method: 'keyboard' | 'click';
|
|
48
|
+
}
|
|
49
|
+
export interface BuildRequiredProps extends DropZoneBaseEventProps {
|
|
50
|
+
method: DropMethod;
|
|
51
|
+
reason: BuildReason | null;
|
|
52
|
+
file_count: number;
|
|
53
|
+
file_types?: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface DeploySucceededProps extends DropZoneBaseEventProps {
|
|
56
|
+
method: DropMethod;
|
|
57
|
+
site_name: string;
|
|
58
|
+
file_count: number;
|
|
59
|
+
/** Whether the deploy landed directly in the visitor's account. */
|
|
60
|
+
authenticated: boolean;
|
|
61
|
+
/** Present only when an authenticated attempt bounced (stale login hint) and the drop completed anonymously. */
|
|
62
|
+
auth_fallback?: true;
|
|
63
|
+
file_types?: string[];
|
|
64
|
+
}
|
|
65
|
+
export interface BuildDeploySucceededProps extends DropZoneBaseEventProps {
|
|
66
|
+
method: DropMethod;
|
|
67
|
+
reason: BuildReason | null;
|
|
68
|
+
site_name: string;
|
|
69
|
+
file_count: number;
|
|
70
|
+
/** Present when build settings were synthesised into the archive. */
|
|
71
|
+
framework?: string;
|
|
72
|
+
file_types?: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface DeployFailedProps extends DropZoneBaseEventProps {
|
|
75
|
+
/** Absent when the failure comes from a stash resume rather than a live drop gesture. */
|
|
76
|
+
method?: DropMethod;
|
|
77
|
+
/** Raw failure reason (e.g. "drop failed: 429", "resume_failed") — the humanized copy goes to the UI, not here. */
|
|
78
|
+
reason: string;
|
|
79
|
+
/** Present only when the file set is known (absent when reading itself threw). */
|
|
80
|
+
file_count?: number;
|
|
81
|
+
file_types?: string[];
|
|
82
|
+
}
|
|
83
|
+
export interface ProjectStashedProps extends DropZoneBaseEventProps {
|
|
84
|
+
method: DropMethod;
|
|
85
|
+
reason: BuildReason | null;
|
|
86
|
+
file_count: number;
|
|
87
|
+
file_types?: string[];
|
|
88
|
+
}
|
|
89
|
+
/** A resume starts from storage, not a fresh gesture — no method or file set to report. */
|
|
90
|
+
export type ResumedProps = DropZoneBaseEventProps;
|
|
91
|
+
/** Event name → its property shape, for typed emitters and sinks on either side of the seam. */
|
|
92
|
+
export interface DropZoneEventProperties {
|
|
93
|
+
dropzone_files_dropped: FilesDroppedProps;
|
|
94
|
+
dropzone_browse_opened: BrowseOpenedProps;
|
|
95
|
+
dropzone_build_required: BuildRequiredProps;
|
|
96
|
+
dropzone_deploy_succeeded: DeploySucceededProps;
|
|
97
|
+
dropzone_build_deploy_succeeded: BuildDeploySucceededProps;
|
|
98
|
+
dropzone_deploy_failed: DeployFailedProps;
|
|
99
|
+
dropzone_project_stashed: ProjectStashedProps;
|
|
100
|
+
dropzone_resumed: ResumedProps;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Provider-agnostic analytics sink. Deliberately loose (string, not the event
|
|
104
|
+
* union): hosts forward these to Segment/GA/GTM and often pipe their own
|
|
105
|
+
* events through the same function.
|
|
106
|
+
*/
|
|
107
|
+
export type TrackFn = (event: string, properties?: Record<string, unknown>) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
/** Files arrived via drag — the picker path reports its files on outcome events instead. */
|
|
3
|
+
FILES_DROPPED: "dropzone_files_dropped",
|
|
4
|
+
/** The native file picker was opened (keyboard or click). */
|
|
5
|
+
BROWSE_OPENED: "dropzone_browse_opened",
|
|
6
|
+
/** The drop needs a build — it will be built in place, stashed, or handed off. */
|
|
7
|
+
BUILD_REQUIRED: "dropzone_build_required",
|
|
8
|
+
/** A static deploy went live (anonymous or into the visitor's account). */
|
|
9
|
+
DEPLOY_SUCCEEDED: "dropzone_deploy_succeeded",
|
|
10
|
+
/** A build was enqueued in the visitor's account. */
|
|
11
|
+
BUILD_DEPLOY_SUCCEEDED: "dropzone_build_deploy_succeeded",
|
|
12
|
+
/** Any attempt ended in an error (including a failed resume). */
|
|
13
|
+
DEPLOY_FAILED: "dropzone_deploy_failed",
|
|
14
|
+
/** A logged-out build drop was stashed locally before the signup hand-off. */
|
|
15
|
+
PROJECT_STASHED: "dropzone_project_stashed",
|
|
16
|
+
/** A stashed build drop was picked up for automatic deployment. */
|
|
17
|
+
RESUMED: "dropzone_resumed"
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
e as DROPZONE_EVENTS
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BuildSite } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The transport both authenticated clients share: JSON calls ride the
|
|
4
|
+
* consumer's access-control rewrite on the session cookie, so nothing
|
|
5
|
+
* credential-shaped lives in the browser and nothing can expire mid-deploy.
|
|
6
|
+
* (Uploads are the exception — the proxy's Lambda caps request bodies at
|
|
7
|
+
* ~6MB — and each client handles its own, bearer-authorized.)
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Create a site in the visitor's account via `POST {proxyBase}/sites` (scoped
|
|
11
|
+
* to `accountSlug` when given, else the user's default account), attributed
|
|
12
|
+
* `created_via: 'drop'`.
|
|
13
|
+
*
|
|
14
|
+
* A logged-out visitor 401s here, before anything is created — the one
|
|
15
|
+
* pre-mutation point where callers may still safely fall back to an anonymous
|
|
16
|
+
* flow, which is why it maps to `NotAuthenticatedError`. Any other failure is
|
|
17
|
+
* a `SiteCreateError` carrying the status.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createSiteInAccount(proxyBase: string, accountSlug?: string): Promise<BuildSite>;
|
|
20
|
+
/** How a watched deploy ended. `errorMessage` is the API's own explanation, when it gave one. */
|
|
21
|
+
export type SettledDeploy = {
|
|
22
|
+
outcome: 'ready';
|
|
23
|
+
} | {
|
|
24
|
+
outcome: 'failed';
|
|
25
|
+
errorMessage?: string;
|
|
26
|
+
} | {
|
|
27
|
+
outcome: 'timed-out';
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Poll `GET {proxyBase}/deploys/{deployId}` on the session cookie until the
|
|
31
|
+
* deploy settles, and report how. Purely mechanical on purpose: each caller
|
|
32
|
+
* maps the outcome onto its own error vocabulary (the drop client throws plain
|
|
33
|
+
* errors `humanizeDropError` understands; the build client throws
|
|
34
|
+
* `BuildFailedError`/`BuildTimeoutError`), so that knowledge stays next to the
|
|
35
|
+
* class it belongs to.
|
|
36
|
+
*
|
|
37
|
+
* A non-ok poll response is skipped, not fatal — a transient proxy hiccup
|
|
38
|
+
* shouldn't kill a deploy that is still progressing.
|
|
39
|
+
*/
|
|
40
|
+
export declare function pollDeployUntilSettled(options: {
|
|
41
|
+
proxyBase: string;
|
|
42
|
+
deployId: string;
|
|
43
|
+
pollIntervalMs: number;
|
|
44
|
+
timeoutMs: number;
|
|
45
|
+
}): Promise<SettledDeploy>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NotAuthenticatedError as d, SiteCreateError as l } from "./errors.js";
|
|
2
|
+
async function f(r, o) {
|
|
3
|
+
const s = o ? `/${o}/sites` : "/sites", e = await fetch(`${r}${s}`, {
|
|
4
|
+
method: "POST",
|
|
5
|
+
credentials: "include",
|
|
6
|
+
headers: { "Content-Type": "application/json" },
|
|
7
|
+
body: JSON.stringify({ created_via: "drop" })
|
|
8
|
+
});
|
|
9
|
+
if (e.status === 401 || e.status === 403) throw new d();
|
|
10
|
+
if (!e.ok) throw new l(e.status);
|
|
11
|
+
return e.json();
|
|
12
|
+
}
|
|
13
|
+
const u = /* @__PURE__ */ new Set(["ready", "error", "rejected"]);
|
|
14
|
+
async function y(r) {
|
|
15
|
+
const { proxyBase: o, deployId: s, pollIntervalMs: e, timeoutMs: i } = r, c = i / e;
|
|
16
|
+
for (let n = 0; n < c; n++) {
|
|
17
|
+
const a = await fetch(`${o}/deploys/${s}`, { credentials: "include" });
|
|
18
|
+
if (a.ok) {
|
|
19
|
+
const t = await a.json();
|
|
20
|
+
if (t.state && u.has(t.state))
|
|
21
|
+
return t.state === "ready" ? { outcome: "ready" } : { outcome: "failed", errorMessage: t.error_message };
|
|
22
|
+
}
|
|
23
|
+
await new Promise((t) => setTimeout(t, e));
|
|
24
|
+
}
|
|
25
|
+
return { outcome: "timed-out" };
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
f as createSiteInAccount,
|
|
29
|
+
y as pollDeployUntilSettled
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|