@squaredr/fieldcraft-pro 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -36
- package/dist/{chunk-MQGR25NG.mjs → chunk-7LQW5QYT.mjs} +1 -3
- package/dist/{chunk-DDQDYTMB.mjs → chunk-CJBC3KWB.mjs} +1 -1
- package/dist/{chunk-LOFGBNJV.mjs → chunk-RSU3X25P.mjs} +1 -1
- package/dist/chunk-VECQKSWS.mjs +582 -0
- package/dist/form-builder/index.js +324 -4
- package/dist/form-builder/index.mjs +2 -1
- package/dist/index.d.mts +52 -3
- package/dist/index.d.ts +52 -3
- package/dist/index.js +587 -30
- package/dist/index.mjs +5 -4
- package/dist/response-viewer/index.js +324 -4
- package/dist/response-viewer/index.mjs +2 -1
- package/dist/theme-editor/index.js +324 -4
- package/dist/theme-editor/index.mjs +2 -1
- package/package.json +12 -4
|
@@ -1,13 +1,333 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fieldcraftProLicense = require('@squaredr/fieldcraft-pro-license');
|
|
4
3
|
var react = require('react');
|
|
5
|
-
var fieldcraftReact = require('@squaredr/fieldcraft-react');
|
|
6
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var fieldcraftReact = require('@squaredr/fieldcraft-react');
|
|
7
6
|
var clsx = require('clsx');
|
|
8
7
|
var tailwindMerge = require('tailwind-merge');
|
|
9
8
|
|
|
10
|
-
//
|
|
9
|
+
// ../license/dist/index.mjs
|
|
10
|
+
var PRO_FEATURES = [
|
|
11
|
+
"SchemaEditor",
|
|
12
|
+
"ResponseViewer",
|
|
13
|
+
"ThemeEditor",
|
|
14
|
+
"FormBuilder",
|
|
15
|
+
"ApiManager",
|
|
16
|
+
"Analytics"
|
|
17
|
+
];
|
|
18
|
+
var ALL_FEATURES = [
|
|
19
|
+
...PRO_FEATURES,
|
|
20
|
+
"Telehealth"
|
|
21
|
+
];
|
|
22
|
+
var TIER_FEATURES = {
|
|
23
|
+
starter: ["SchemaEditor", "ResponseViewer"],
|
|
24
|
+
pro: PRO_FEATURES,
|
|
25
|
+
business: ALL_FEATURES,
|
|
26
|
+
enterprise: ALL_FEATURES
|
|
27
|
+
};
|
|
28
|
+
function tierHasFeature(tier, featureName) {
|
|
29
|
+
return TIER_FEATURES[tier]?.includes(featureName) ?? false;
|
|
30
|
+
}
|
|
31
|
+
var DEV_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
32
|
+
"localhost",
|
|
33
|
+
"127.0.0.1",
|
|
34
|
+
"0.0.0.0",
|
|
35
|
+
"[::1]",
|
|
36
|
+
"::1"
|
|
37
|
+
]);
|
|
38
|
+
var DEV_HOSTNAME_PATTERNS = [
|
|
39
|
+
/^192\.168\.\d+\.\d+$/,
|
|
40
|
+
// local network
|
|
41
|
+
/^10\.\d+\.\d+\.\d+$/,
|
|
42
|
+
// local network
|
|
43
|
+
/^172\.(1[6-9]|2\d|3[01])\.\d+\.\d+$/
|
|
44
|
+
// local network
|
|
45
|
+
];
|
|
46
|
+
var PRODUCTION_HOST_SUFFIXES = [
|
|
47
|
+
".vercel.app",
|
|
48
|
+
".netlify.app",
|
|
49
|
+
".netlify.com",
|
|
50
|
+
".herokuapp.com",
|
|
51
|
+
".fly.dev",
|
|
52
|
+
".railway.app",
|
|
53
|
+
".render.com",
|
|
54
|
+
".onrender.com",
|
|
55
|
+
".pages.dev",
|
|
56
|
+
// Cloudflare Pages
|
|
57
|
+
".workers.dev",
|
|
58
|
+
// Cloudflare Workers
|
|
59
|
+
".azurewebsites.net",
|
|
60
|
+
".web.app",
|
|
61
|
+
// Firebase
|
|
62
|
+
".firebaseapp.com",
|
|
63
|
+
".amplifyapp.com",
|
|
64
|
+
".surge.sh",
|
|
65
|
+
".github.io",
|
|
66
|
+
".gitlab.io"
|
|
67
|
+
];
|
|
68
|
+
function isDevHostname(hostname) {
|
|
69
|
+
if (DEV_HOSTNAMES.has(hostname)) return true;
|
|
70
|
+
for (const pattern of DEV_HOSTNAME_PATTERNS) {
|
|
71
|
+
if (pattern.test(hostname)) return true;
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
function isKnownProductionHost(hostname) {
|
|
76
|
+
for (const suffix of PRODUCTION_HOST_SUFFIXES) {
|
|
77
|
+
if (hostname.endsWith(suffix)) return true;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
function hasRealTLD(hostname) {
|
|
82
|
+
return /\.[a-z]{2,}$/i.test(hostname) && !isDevHostname(hostname);
|
|
83
|
+
}
|
|
84
|
+
function isProductionEnvironment() {
|
|
85
|
+
const _proc = typeof globalThis !== "undefined" ? globalThis.process : void 0;
|
|
86
|
+
if (_proc?.env) {
|
|
87
|
+
const nodeEnv = _proc.env.NODE_ENV;
|
|
88
|
+
if (nodeEnv === "production") return true;
|
|
89
|
+
if (nodeEnv === "development" || nodeEnv === "test") return false;
|
|
90
|
+
}
|
|
91
|
+
if (typeof window !== "undefined" && window.location) {
|
|
92
|
+
const { hostname, protocol, port } = window.location;
|
|
93
|
+
if (protocol === "file:") return false;
|
|
94
|
+
if (isDevHostname(hostname)) return false;
|
|
95
|
+
if (port && port !== "443" && port !== "80") return false;
|
|
96
|
+
if (isKnownProductionHost(hostname)) return true;
|
|
97
|
+
if (protocol === "https:" && hasRealTLD(hostname)) return true;
|
|
98
|
+
if (hasRealTLD(hostname)) return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
var defaultContext = { status: "validating", tier: null };
|
|
103
|
+
var LicenseCtx = react.createContext(defaultContext);
|
|
104
|
+
function useLicense() {
|
|
105
|
+
return react.useContext(LicenseCtx);
|
|
106
|
+
}
|
|
107
|
+
function UnlicensedOverlay({ featureName, reason, children }) {
|
|
108
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", minHeight: "200px" }, children: [
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { pointerEvents: "none", userSelect: "none", filter: "blur(2px)" }, children }),
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
style: {
|
|
114
|
+
position: "absolute",
|
|
115
|
+
inset: 0,
|
|
116
|
+
zIndex: 2147483647,
|
|
117
|
+
display: "flex",
|
|
118
|
+
flexDirection: "column",
|
|
119
|
+
alignItems: "center",
|
|
120
|
+
justifyContent: "center",
|
|
121
|
+
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
122
|
+
backdropFilter: "blur(4px)",
|
|
123
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
124
|
+
padding: "32px"
|
|
125
|
+
},
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
style: {
|
|
131
|
+
position: "absolute",
|
|
132
|
+
inset: 0,
|
|
133
|
+
overflow: "hidden",
|
|
134
|
+
pointerEvents: "none",
|
|
135
|
+
zIndex: 0
|
|
136
|
+
},
|
|
137
|
+
children: Array.from({ length: 12 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
style: {
|
|
141
|
+
position: "absolute",
|
|
142
|
+
top: `${i * 80}px`,
|
|
143
|
+
left: "-50%",
|
|
144
|
+
right: "-50%",
|
|
145
|
+
textAlign: "center",
|
|
146
|
+
transform: "rotate(-30deg)",
|
|
147
|
+
fontSize: "18px",
|
|
148
|
+
fontWeight: 700,
|
|
149
|
+
color: "rgba(255, 255, 255, 0.06)",
|
|
150
|
+
letterSpacing: "8px",
|
|
151
|
+
textTransform: "uppercase",
|
|
152
|
+
whiteSpace: "nowrap",
|
|
153
|
+
userSelect: "none"
|
|
154
|
+
},
|
|
155
|
+
children: "UNLICENSED \u2022 FIELDCRAFT PRO \u2022 UNLICENSED \u2022 FIELDCRAFT PRO \u2022 UNLICENSED \u2022 FIELDCRAFT PRO"
|
|
156
|
+
},
|
|
157
|
+
i
|
|
158
|
+
))
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
style: {
|
|
165
|
+
position: "relative",
|
|
166
|
+
zIndex: 1,
|
|
167
|
+
textAlign: "center",
|
|
168
|
+
maxWidth: "420px"
|
|
169
|
+
},
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
style: {
|
|
175
|
+
width: "64px",
|
|
176
|
+
height: "64px",
|
|
177
|
+
margin: "0 auto 16px",
|
|
178
|
+
borderRadius: "50%",
|
|
179
|
+
backgroundColor: "rgba(239, 68, 68, 0.2)",
|
|
180
|
+
border: "2px solid rgba(239, 68, 68, 0.5)",
|
|
181
|
+
display: "flex",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
justifyContent: "center",
|
|
184
|
+
fontSize: "28px"
|
|
185
|
+
},
|
|
186
|
+
children: "\u{1F6E1}"
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
style: {
|
|
193
|
+
fontSize: "22px",
|
|
194
|
+
fontWeight: 700,
|
|
195
|
+
color: "#ffffff",
|
|
196
|
+
marginBottom: "8px",
|
|
197
|
+
letterSpacing: "-0.02em"
|
|
198
|
+
},
|
|
199
|
+
children: "License Required"
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
style: {
|
|
206
|
+
fontSize: "15px",
|
|
207
|
+
fontWeight: 600,
|
|
208
|
+
color: "#f87171",
|
|
209
|
+
marginBottom: "6px"
|
|
210
|
+
},
|
|
211
|
+
children: featureName
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
215
|
+
"div",
|
|
216
|
+
{
|
|
217
|
+
style: {
|
|
218
|
+
fontSize: "14px",
|
|
219
|
+
color: "#d1d5db",
|
|
220
|
+
marginBottom: "24px",
|
|
221
|
+
lineHeight: "1.5"
|
|
222
|
+
},
|
|
223
|
+
children: reason
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "10px", justifyContent: "center", flexWrap: "wrap" }, children: [
|
|
227
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
228
|
+
"a",
|
|
229
|
+
{
|
|
230
|
+
href: "https://squaredr.tech/products/fieldcraft/admin-pro#pricing",
|
|
231
|
+
target: "_blank",
|
|
232
|
+
rel: "noopener noreferrer",
|
|
233
|
+
style: {
|
|
234
|
+
display: "inline-block",
|
|
235
|
+
padding: "12px 24px",
|
|
236
|
+
fontSize: "14px",
|
|
237
|
+
fontWeight: 600,
|
|
238
|
+
color: "#ffffff",
|
|
239
|
+
backgroundColor: "#2563eb",
|
|
240
|
+
borderRadius: "8px",
|
|
241
|
+
textDecoration: "none",
|
|
242
|
+
boxShadow: "0 4px 14px rgba(37, 99, 235, 0.4)"
|
|
243
|
+
},
|
|
244
|
+
children: "Get a License"
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
+
"a",
|
|
249
|
+
{
|
|
250
|
+
href: "https://discord.gg/zMxdu5UVW",
|
|
251
|
+
target: "_blank",
|
|
252
|
+
rel: "noopener noreferrer",
|
|
253
|
+
style: {
|
|
254
|
+
display: "inline-block",
|
|
255
|
+
padding: "12px 24px",
|
|
256
|
+
fontSize: "14px",
|
|
257
|
+
fontWeight: 600,
|
|
258
|
+
color: "#93c5fd",
|
|
259
|
+
backgroundColor: "rgba(37, 99, 235, 0.15)",
|
|
260
|
+
border: "1px solid rgba(37, 99, 235, 0.4)",
|
|
261
|
+
borderRadius: "8px",
|
|
262
|
+
textDecoration: "none"
|
|
263
|
+
},
|
|
264
|
+
children: "Join Discord"
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
] }),
|
|
268
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
269
|
+
"div",
|
|
270
|
+
{
|
|
271
|
+
style: {
|
|
272
|
+
fontSize: "12px",
|
|
273
|
+
color: "#6b7280",
|
|
274
|
+
marginTop: "16px"
|
|
275
|
+
},
|
|
276
|
+
children: [
|
|
277
|
+
"This component works freely in development.",
|
|
278
|
+
" ",
|
|
279
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
280
|
+
"a",
|
|
281
|
+
{
|
|
282
|
+
href: "https://squaredr.tech/products/fieldcraft/docs/pro/license",
|
|
283
|
+
target: "_blank",
|
|
284
|
+
rel: "noopener noreferrer",
|
|
285
|
+
style: { color: "#9ca3af", textDecoration: "underline" },
|
|
286
|
+
children: "Learn more"
|
|
287
|
+
}
|
|
288
|
+
)
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] });
|
|
299
|
+
}
|
|
300
|
+
function requireLicense(Component, featureName) {
|
|
301
|
+
function LicenseGated(props) {
|
|
302
|
+
const { status, tier } = useLicense();
|
|
303
|
+
const isProduction = isProductionEnvironment();
|
|
304
|
+
if (!isProduction) {
|
|
305
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
306
|
+
}
|
|
307
|
+
if (status === "validating") {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
const isLicensed = status === "valid" && tier != null && tierHasFeature(tier, featureName);
|
|
311
|
+
if (isLicensed) {
|
|
312
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
313
|
+
}
|
|
314
|
+
let reason = "A valid license is required for production use.";
|
|
315
|
+
if (status === "invalid") {
|
|
316
|
+
reason = "Invalid license key. Please check your license key and try again.";
|
|
317
|
+
} else if (status === "expired") {
|
|
318
|
+
reason = "Your license has expired. Please renew to continue using this component in production.";
|
|
319
|
+
} else if (status === "revoked") {
|
|
320
|
+
reason = "This license key has been revoked. Please contact support or purchase a new license.";
|
|
321
|
+
} else if (status === "domain_mismatch") {
|
|
322
|
+
reason = "This license key is registered to a different domain. Each key can only be used on one production domain. Please purchase a new license for this domain.";
|
|
323
|
+
} else if (!tier || !tierHasFeature(tier, featureName)) {
|
|
324
|
+
reason = "Your license does not include this feature. Please upgrade your plan.";
|
|
325
|
+
}
|
|
326
|
+
return /* @__PURE__ */ jsxRuntime.jsx(UnlicensedOverlay, { featureName, reason, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props }) });
|
|
327
|
+
}
|
|
328
|
+
LicenseGated.displayName = `requireLicense(${Component.displayName || Component.name || "Component"})`;
|
|
329
|
+
return LicenseGated;
|
|
330
|
+
}
|
|
11
331
|
|
|
12
332
|
// src/response-viewer/clinical-display-data.ts
|
|
13
333
|
var BODY_REGION_LABELS = {
|
|
@@ -979,6 +1299,6 @@ function getAllQuestions2(schema) {
|
|
|
979
1299
|
}
|
|
980
1300
|
|
|
981
1301
|
// src/response-viewer/ResponseViewer.tsx
|
|
982
|
-
var ResponseViewer =
|
|
1302
|
+
var ResponseViewer = requireLicense(ResponseViewerInner, "ResponseViewer");
|
|
983
1303
|
|
|
984
1304
|
exports.ResponseViewer = ResponseViewer;
|
|
@@ -1,11 +1,331 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fieldcraftProLicense = require('@squaredr/fieldcraft-pro-license');
|
|
4
3
|
var react = require('react');
|
|
5
|
-
var fieldcraftReact = require('@squaredr/fieldcraft-react');
|
|
6
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var fieldcraftReact = require('@squaredr/fieldcraft-react');
|
|
7
6
|
|
|
8
|
-
//
|
|
7
|
+
// ../license/dist/index.mjs
|
|
8
|
+
var PRO_FEATURES = [
|
|
9
|
+
"SchemaEditor",
|
|
10
|
+
"ResponseViewer",
|
|
11
|
+
"ThemeEditor",
|
|
12
|
+
"FormBuilder",
|
|
13
|
+
"ApiManager",
|
|
14
|
+
"Analytics"
|
|
15
|
+
];
|
|
16
|
+
var ALL_FEATURES = [
|
|
17
|
+
...PRO_FEATURES,
|
|
18
|
+
"Telehealth"
|
|
19
|
+
];
|
|
20
|
+
var TIER_FEATURES = {
|
|
21
|
+
starter: ["SchemaEditor", "ResponseViewer"],
|
|
22
|
+
pro: PRO_FEATURES,
|
|
23
|
+
business: ALL_FEATURES,
|
|
24
|
+
enterprise: ALL_FEATURES
|
|
25
|
+
};
|
|
26
|
+
function tierHasFeature(tier, featureName) {
|
|
27
|
+
return TIER_FEATURES[tier]?.includes(featureName) ?? false;
|
|
28
|
+
}
|
|
29
|
+
var DEV_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
30
|
+
"localhost",
|
|
31
|
+
"127.0.0.1",
|
|
32
|
+
"0.0.0.0",
|
|
33
|
+
"[::1]",
|
|
34
|
+
"::1"
|
|
35
|
+
]);
|
|
36
|
+
var DEV_HOSTNAME_PATTERNS = [
|
|
37
|
+
/^192\.168\.\d+\.\d+$/,
|
|
38
|
+
// local network
|
|
39
|
+
/^10\.\d+\.\d+\.\d+$/,
|
|
40
|
+
// local network
|
|
41
|
+
/^172\.(1[6-9]|2\d|3[01])\.\d+\.\d+$/
|
|
42
|
+
// local network
|
|
43
|
+
];
|
|
44
|
+
var PRODUCTION_HOST_SUFFIXES = [
|
|
45
|
+
".vercel.app",
|
|
46
|
+
".netlify.app",
|
|
47
|
+
".netlify.com",
|
|
48
|
+
".herokuapp.com",
|
|
49
|
+
".fly.dev",
|
|
50
|
+
".railway.app",
|
|
51
|
+
".render.com",
|
|
52
|
+
".onrender.com",
|
|
53
|
+
".pages.dev",
|
|
54
|
+
// Cloudflare Pages
|
|
55
|
+
".workers.dev",
|
|
56
|
+
// Cloudflare Workers
|
|
57
|
+
".azurewebsites.net",
|
|
58
|
+
".web.app",
|
|
59
|
+
// Firebase
|
|
60
|
+
".firebaseapp.com",
|
|
61
|
+
".amplifyapp.com",
|
|
62
|
+
".surge.sh",
|
|
63
|
+
".github.io",
|
|
64
|
+
".gitlab.io"
|
|
65
|
+
];
|
|
66
|
+
function isDevHostname(hostname) {
|
|
67
|
+
if (DEV_HOSTNAMES.has(hostname)) return true;
|
|
68
|
+
for (const pattern of DEV_HOSTNAME_PATTERNS) {
|
|
69
|
+
if (pattern.test(hostname)) return true;
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
function isKnownProductionHost(hostname) {
|
|
74
|
+
for (const suffix of PRODUCTION_HOST_SUFFIXES) {
|
|
75
|
+
if (hostname.endsWith(suffix)) return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
function hasRealTLD(hostname) {
|
|
80
|
+
return /\.[a-z]{2,}$/i.test(hostname) && !isDevHostname(hostname);
|
|
81
|
+
}
|
|
82
|
+
function isProductionEnvironment() {
|
|
83
|
+
const _proc = typeof globalThis !== "undefined" ? globalThis.process : void 0;
|
|
84
|
+
if (_proc?.env) {
|
|
85
|
+
const nodeEnv = _proc.env.NODE_ENV;
|
|
86
|
+
if (nodeEnv === "production") return true;
|
|
87
|
+
if (nodeEnv === "development" || nodeEnv === "test") return false;
|
|
88
|
+
}
|
|
89
|
+
if (typeof window !== "undefined" && window.location) {
|
|
90
|
+
const { hostname, protocol, port } = window.location;
|
|
91
|
+
if (protocol === "file:") return false;
|
|
92
|
+
if (isDevHostname(hostname)) return false;
|
|
93
|
+
if (port && port !== "443" && port !== "80") return false;
|
|
94
|
+
if (isKnownProductionHost(hostname)) return true;
|
|
95
|
+
if (protocol === "https:" && hasRealTLD(hostname)) return true;
|
|
96
|
+
if (hasRealTLD(hostname)) return true;
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
var defaultContext = { status: "validating", tier: null };
|
|
101
|
+
var LicenseCtx = react.createContext(defaultContext);
|
|
102
|
+
function useLicense() {
|
|
103
|
+
return react.useContext(LicenseCtx);
|
|
104
|
+
}
|
|
105
|
+
function UnlicensedOverlay({ featureName, reason, children }) {
|
|
106
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative", minHeight: "200px" }, children: [
|
|
107
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { pointerEvents: "none", userSelect: "none", filter: "blur(2px)" }, children }),
|
|
108
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
style: {
|
|
112
|
+
position: "absolute",
|
|
113
|
+
inset: 0,
|
|
114
|
+
zIndex: 2147483647,
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
120
|
+
backdropFilter: "blur(4px)",
|
|
121
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
122
|
+
padding: "32px"
|
|
123
|
+
},
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
style: {
|
|
129
|
+
position: "absolute",
|
|
130
|
+
inset: 0,
|
|
131
|
+
overflow: "hidden",
|
|
132
|
+
pointerEvents: "none",
|
|
133
|
+
zIndex: 0
|
|
134
|
+
},
|
|
135
|
+
children: Array.from({ length: 12 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
136
|
+
"div",
|
|
137
|
+
{
|
|
138
|
+
style: {
|
|
139
|
+
position: "absolute",
|
|
140
|
+
top: `${i * 80}px`,
|
|
141
|
+
left: "-50%",
|
|
142
|
+
right: "-50%",
|
|
143
|
+
textAlign: "center",
|
|
144
|
+
transform: "rotate(-30deg)",
|
|
145
|
+
fontSize: "18px",
|
|
146
|
+
fontWeight: 700,
|
|
147
|
+
color: "rgba(255, 255, 255, 0.06)",
|
|
148
|
+
letterSpacing: "8px",
|
|
149
|
+
textTransform: "uppercase",
|
|
150
|
+
whiteSpace: "nowrap",
|
|
151
|
+
userSelect: "none"
|
|
152
|
+
},
|
|
153
|
+
children: "UNLICENSED \u2022 FIELDCRAFT PRO \u2022 UNLICENSED \u2022 FIELDCRAFT PRO \u2022 UNLICENSED \u2022 FIELDCRAFT PRO"
|
|
154
|
+
},
|
|
155
|
+
i
|
|
156
|
+
))
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
160
|
+
"div",
|
|
161
|
+
{
|
|
162
|
+
style: {
|
|
163
|
+
position: "relative",
|
|
164
|
+
zIndex: 1,
|
|
165
|
+
textAlign: "center",
|
|
166
|
+
maxWidth: "420px"
|
|
167
|
+
},
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
style: {
|
|
173
|
+
width: "64px",
|
|
174
|
+
height: "64px",
|
|
175
|
+
margin: "0 auto 16px",
|
|
176
|
+
borderRadius: "50%",
|
|
177
|
+
backgroundColor: "rgba(239, 68, 68, 0.2)",
|
|
178
|
+
border: "2px solid rgba(239, 68, 68, 0.5)",
|
|
179
|
+
display: "flex",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
justifyContent: "center",
|
|
182
|
+
fontSize: "28px"
|
|
183
|
+
},
|
|
184
|
+
children: "\u{1F6E1}"
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
188
|
+
"div",
|
|
189
|
+
{
|
|
190
|
+
style: {
|
|
191
|
+
fontSize: "22px",
|
|
192
|
+
fontWeight: 700,
|
|
193
|
+
color: "#ffffff",
|
|
194
|
+
marginBottom: "8px",
|
|
195
|
+
letterSpacing: "-0.02em"
|
|
196
|
+
},
|
|
197
|
+
children: "License Required"
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
201
|
+
"div",
|
|
202
|
+
{
|
|
203
|
+
style: {
|
|
204
|
+
fontSize: "15px",
|
|
205
|
+
fontWeight: 600,
|
|
206
|
+
color: "#f87171",
|
|
207
|
+
marginBottom: "6px"
|
|
208
|
+
},
|
|
209
|
+
children: featureName
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
213
|
+
"div",
|
|
214
|
+
{
|
|
215
|
+
style: {
|
|
216
|
+
fontSize: "14px",
|
|
217
|
+
color: "#d1d5db",
|
|
218
|
+
marginBottom: "24px",
|
|
219
|
+
lineHeight: "1.5"
|
|
220
|
+
},
|
|
221
|
+
children: reason
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "10px", justifyContent: "center", flexWrap: "wrap" }, children: [
|
|
225
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
+
"a",
|
|
227
|
+
{
|
|
228
|
+
href: "https://squaredr.tech/products/fieldcraft/admin-pro#pricing",
|
|
229
|
+
target: "_blank",
|
|
230
|
+
rel: "noopener noreferrer",
|
|
231
|
+
style: {
|
|
232
|
+
display: "inline-block",
|
|
233
|
+
padding: "12px 24px",
|
|
234
|
+
fontSize: "14px",
|
|
235
|
+
fontWeight: 600,
|
|
236
|
+
color: "#ffffff",
|
|
237
|
+
backgroundColor: "#2563eb",
|
|
238
|
+
borderRadius: "8px",
|
|
239
|
+
textDecoration: "none",
|
|
240
|
+
boxShadow: "0 4px 14px rgba(37, 99, 235, 0.4)"
|
|
241
|
+
},
|
|
242
|
+
children: "Get a License"
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
246
|
+
"a",
|
|
247
|
+
{
|
|
248
|
+
href: "https://discord.gg/zMxdu5UVW",
|
|
249
|
+
target: "_blank",
|
|
250
|
+
rel: "noopener noreferrer",
|
|
251
|
+
style: {
|
|
252
|
+
display: "inline-block",
|
|
253
|
+
padding: "12px 24px",
|
|
254
|
+
fontSize: "14px",
|
|
255
|
+
fontWeight: 600,
|
|
256
|
+
color: "#93c5fd",
|
|
257
|
+
backgroundColor: "rgba(37, 99, 235, 0.15)",
|
|
258
|
+
border: "1px solid rgba(37, 99, 235, 0.4)",
|
|
259
|
+
borderRadius: "8px",
|
|
260
|
+
textDecoration: "none"
|
|
261
|
+
},
|
|
262
|
+
children: "Join Discord"
|
|
263
|
+
}
|
|
264
|
+
)
|
|
265
|
+
] }),
|
|
266
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
267
|
+
"div",
|
|
268
|
+
{
|
|
269
|
+
style: {
|
|
270
|
+
fontSize: "12px",
|
|
271
|
+
color: "#6b7280",
|
|
272
|
+
marginTop: "16px"
|
|
273
|
+
},
|
|
274
|
+
children: [
|
|
275
|
+
"This component works freely in development.",
|
|
276
|
+
" ",
|
|
277
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
278
|
+
"a",
|
|
279
|
+
{
|
|
280
|
+
href: "https://squaredr.tech/products/fieldcraft/docs/pro/license",
|
|
281
|
+
target: "_blank",
|
|
282
|
+
rel: "noopener noreferrer",
|
|
283
|
+
style: { color: "#9ca3af", textDecoration: "underline" },
|
|
284
|
+
children: "Learn more"
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] });
|
|
297
|
+
}
|
|
298
|
+
function requireLicense(Component, featureName) {
|
|
299
|
+
function LicenseGated(props) {
|
|
300
|
+
const { status, tier } = useLicense();
|
|
301
|
+
const isProduction = isProductionEnvironment();
|
|
302
|
+
if (!isProduction) {
|
|
303
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
304
|
+
}
|
|
305
|
+
if (status === "validating") {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
const isLicensed = status === "valid" && tier != null && tierHasFeature(tier, featureName);
|
|
309
|
+
if (isLicensed) {
|
|
310
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
|
|
311
|
+
}
|
|
312
|
+
let reason = "A valid license is required for production use.";
|
|
313
|
+
if (status === "invalid") {
|
|
314
|
+
reason = "Invalid license key. Please check your license key and try again.";
|
|
315
|
+
} else if (status === "expired") {
|
|
316
|
+
reason = "Your license has expired. Please renew to continue using this component in production.";
|
|
317
|
+
} else if (status === "revoked") {
|
|
318
|
+
reason = "This license key has been revoked. Please contact support or purchase a new license.";
|
|
319
|
+
} else if (status === "domain_mismatch") {
|
|
320
|
+
reason = "This license key is registered to a different domain. Each key can only be used on one production domain. Please purchase a new license for this domain.";
|
|
321
|
+
} else if (!tier || !tierHasFeature(tier, featureName)) {
|
|
322
|
+
reason = "Your license does not include this feature. Please upgrade your plan.";
|
|
323
|
+
}
|
|
324
|
+
return /* @__PURE__ */ jsxRuntime.jsx(UnlicensedOverlay, { featureName, reason, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props }) });
|
|
325
|
+
}
|
|
326
|
+
LicenseGated.displayName = `requireLicense(${Component.displayName || Component.name || "Component"})`;
|
|
327
|
+
return LicenseGated;
|
|
328
|
+
}
|
|
9
329
|
|
|
10
330
|
// src/theme-editor/preview-schema.ts
|
|
11
331
|
var PREVIEW_SCHEMA = {
|
|
@@ -406,7 +726,7 @@ function ThemeEditorInner({
|
|
|
406
726
|
}
|
|
407
727
|
|
|
408
728
|
// src/theme-editor/ThemeEditor.tsx
|
|
409
|
-
var ThemeEditor =
|
|
729
|
+
var ThemeEditor = requireLicense(ThemeEditorInner, "ThemeEditor");
|
|
410
730
|
|
|
411
731
|
exports.PREVIEW_SCHEMA = PREVIEW_SCHEMA;
|
|
412
732
|
exports.ThemeEditor = ThemeEditor;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner } from '../chunk-
|
|
1
|
+
export { PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner } from '../chunk-7LQW5QYT.mjs';
|
|
2
|
+
import '../chunk-VECQKSWS.mjs';
|