@sonicjs-cms/core 2.14.0 → 2.15.0
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/admin-layout-catalyst.template-HFD37TY5.cjs +17 -0
- package/dist/admin-layout-catalyst.template-HFD37TY5.cjs.map +1 -0
- package/dist/admin-layout-catalyst.template-UMTIN66R.js +7 -0
- package/dist/admin-layout-catalyst.template-UMTIN66R.js.map +1 -0
- package/dist/{chunk-DRWSHIFG.cjs → chunk-26HYU7MX.cjs} +228 -658
- package/dist/chunk-26HYU7MX.cjs.map +1 -0
- package/dist/{chunk-AFGOH2F6.js → chunk-2BL2A62D.js} +4 -4
- package/dist/{chunk-AFGOH2F6.js.map → chunk-2BL2A62D.js.map} +1 -1
- package/dist/{chunk-I6FFGQIT.cjs → chunk-43AB4EH4.cjs} +723 -211
- package/dist/chunk-43AB4EH4.cjs.map +1 -0
- package/dist/{chunk-3QCEYJLK.cjs → chunk-4ZSNJDLS.cjs} +9 -9
- package/dist/{chunk-3QCEYJLK.cjs.map → chunk-4ZSNJDLS.cjs.map} +1 -1
- package/dist/chunk-55RDMDOP.js +684 -0
- package/dist/chunk-55RDMDOP.js.map +1 -0
- package/dist/{chunk-JKNKO6LA.js → chunk-5SOFMH66.js} +2 -2
- package/dist/{chunk-JKNKO6LA.js.map → chunk-5SOFMH66.js.map} +1 -1
- package/dist/{chunk-6FHNRRJ3.cjs → chunk-635JAMSE.cjs} +76 -17
- package/dist/chunk-635JAMSE.cjs.map +1 -0
- package/dist/{chunk-23DP6TO5.js → chunk-7MMD5WMK.js} +44 -474
- package/dist/chunk-7MMD5WMK.js.map +1 -0
- package/dist/{chunk-56GUBLJE.cjs → chunk-ABB34XUS.cjs} +13 -13
- package/dist/{chunk-56GUBLJE.cjs.map → chunk-ABB34XUS.cjs.map} +1 -1
- package/dist/{chunk-GAVTTYMC.js → chunk-EWXV2KG2.js} +3 -3
- package/dist/{chunk-GAVTTYMC.js.map → chunk-EWXV2KG2.js.map} +1 -1
- package/dist/{chunk-J5WGMRSU.js → chunk-EXNEW5US.js} +76 -17
- package/dist/chunk-EXNEW5US.js.map +1 -0
- package/dist/{chunk-H3XXBAMO.js → chunk-G7XSN72O.js} +722 -212
- package/dist/chunk-G7XSN72O.js.map +1 -0
- package/dist/{chunk-QP3OHHON.cjs → chunk-OHYBNCVL.cjs} +18 -696
- package/dist/chunk-OHYBNCVL.cjs.map +1 -0
- package/dist/{chunk-CB7ONLGB.js → chunk-ON5ZMSU4.js} +3 -3
- package/dist/{chunk-CB7ONLGB.js.map → chunk-ON5ZMSU4.js.map} +1 -1
- package/dist/{chunk-KZ2MFGET.cjs → chunk-RVD7PLMU.cjs} +2 -2
- package/dist/{chunk-KZ2MFGET.cjs.map → chunk-RVD7PLMU.cjs.map} +1 -1
- package/dist/{chunk-2MXF4RYZ.js → chunk-TFNTM3OA.js} +3 -3
- package/dist/{chunk-2MXF4RYZ.js.map → chunk-TFNTM3OA.js.map} +1 -1
- package/dist/{chunk-YYMPHM3I.cjs → chunk-UFPT5KCQ.cjs} +8 -8
- package/dist/{chunk-YYMPHM3I.cjs.map → chunk-UFPT5KCQ.cjs.map} +1 -1
- package/dist/chunk-UYJ6TJHX.cjs +691 -0
- package/dist/chunk-UYJ6TJHX.cjs.map +1 -0
- package/dist/{chunk-YULUPQZV.cjs → chunk-VUISYUHY.cjs} +3 -3
- package/dist/{chunk-YULUPQZV.cjs.map → chunk-VUISYUHY.cjs.map} +1 -1
- package/dist/{chunk-JTUCC6WZ.js → chunk-XWIA3HVX.js} +9 -683
- package/dist/chunk-XWIA3HVX.js.map +1 -0
- package/dist/index.cjs +910 -233
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +765 -88
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +29 -29
- package/dist/middleware.js +3 -3
- package/dist/migrations-APFGYCB6.cjs +13 -0
- package/dist/{migrations-F7KVA74T.cjs.map → migrations-APFGYCB6.cjs.map} +1 -1
- package/dist/migrations-YB52SLW7.js +4 -0
- package/dist/{migrations-WKONKRN7.js.map → migrations-YB52SLW7.js.map} +1 -1
- package/dist/{plugin-bootstrap-BGwBraaN.d.cts → plugin-bootstrap-DfVerYV4.d.cts} +2 -1
- package/dist/{plugin-bootstrap-Drns7X9w.d.ts → plugin-bootstrap-P_ciLp_C.d.ts} +2 -1
- package/dist/plugins.cjs +11 -11
- package/dist/plugins.js +2 -2
- package/dist/routes.cjs +31 -30
- package/dist/routes.js +8 -7
- package/dist/services.cjs +23 -23
- package/dist/services.js +2 -2
- package/dist/templates.cjs +26 -25
- package/dist/templates.js +3 -2
- package/dist/utils.cjs +11 -11
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-23DP6TO5.js.map +0 -1
- package/dist/chunk-6FHNRRJ3.cjs.map +0 -1
- package/dist/chunk-DRWSHIFG.cjs.map +0 -1
- package/dist/chunk-H3XXBAMO.js.map +0 -1
- package/dist/chunk-I6FFGQIT.cjs.map +0 -1
- package/dist/chunk-J5WGMRSU.js.map +0 -1
- package/dist/chunk-JTUCC6WZ.js.map +0 -1
- package/dist/chunk-QP3OHHON.cjs.map +0 -1
- package/dist/migrations-F7KVA74T.cjs +0 -13
- package/dist/migrations-WKONKRN7.js +0 -4
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk26HYU7MX_cjs = require('./chunk-26HYU7MX.cjs');
|
|
4
4
|
var chunkNZWFCUDA_cjs = require('./chunk-NZWFCUDA.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
5
|
+
var chunkUFPT5KCQ_cjs = require('./chunk-UFPT5KCQ.cjs');
|
|
6
|
+
var chunk43AB4EH4_cjs = require('./chunk-43AB4EH4.cjs');
|
|
7
|
+
var chunkRVD7PLMU_cjs = require('./chunk-RVD7PLMU.cjs');
|
|
8
|
+
var chunk4ZSNJDLS_cjs = require('./chunk-4ZSNJDLS.cjs');
|
|
9
|
+
var chunkOHYBNCVL_cjs = require('./chunk-OHYBNCVL.cjs');
|
|
10
|
+
var chunkUYJ6TJHX_cjs = require('./chunk-UYJ6TJHX.cjs');
|
|
11
|
+
var chunkABB34XUS_cjs = require('./chunk-ABB34XUS.cjs');
|
|
12
|
+
var chunk635JAMSE_cjs = require('./chunk-635JAMSE.cjs');
|
|
13
|
+
var chunkVUISYUHY_cjs = require('./chunk-VUISYUHY.cjs');
|
|
13
14
|
require('./chunk-P3XDZL6Q.cjs');
|
|
14
15
|
var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
|
|
15
16
|
var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
|
|
@@ -235,7 +236,7 @@ var DatabaseToolsService = class {
|
|
|
235
236
|
};
|
|
236
237
|
|
|
237
238
|
// src/templates/pages/admin-database-table.template.ts
|
|
238
|
-
|
|
239
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
239
240
|
function renderDatabaseTablePage(data) {
|
|
240
241
|
const totalPages = Math.ceil(data.totalRows / data.pageSize);
|
|
241
242
|
const startRow = (data.currentPage - 1) * data.pageSize + 1;
|
|
@@ -484,7 +485,7 @@ function renderDatabaseTablePage(data) {
|
|
|
484
485
|
user: data.user,
|
|
485
486
|
content: pageContent
|
|
486
487
|
};
|
|
487
|
-
return
|
|
488
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
488
489
|
}
|
|
489
490
|
function generatePageNumbers(currentPage, totalPages) {
|
|
490
491
|
const pages = [];
|
|
@@ -559,7 +560,7 @@ function formatCellValue(value) {
|
|
|
559
560
|
// src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
|
|
560
561
|
function createDatabaseToolsAdminRoutes() {
|
|
561
562
|
const router3 = new hono.Hono();
|
|
562
|
-
router3.use("*",
|
|
563
|
+
router3.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
563
564
|
router3.get("/api/stats", async (c) => {
|
|
564
565
|
try {
|
|
565
566
|
const user = c.get("user");
|
|
@@ -1307,7 +1308,7 @@ function createSeedDataAdminRoutes() {
|
|
|
1307
1308
|
return routes;
|
|
1308
1309
|
}
|
|
1309
1310
|
function createEmailPlugin() {
|
|
1310
|
-
const builder =
|
|
1311
|
+
const builder = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
1311
1312
|
name: "email",
|
|
1312
1313
|
version: "1.0.0-beta.1",
|
|
1313
1314
|
description: "Send transactional emails using Resend"
|
|
@@ -1736,7 +1737,7 @@ var DEFAULT_SETTINGS = {
|
|
|
1736
1737
|
allowNewUserRegistration: false
|
|
1737
1738
|
};
|
|
1738
1739
|
function createOTPLoginPlugin() {
|
|
1739
|
-
const builder =
|
|
1740
|
+
const builder = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
1740
1741
|
name: "otp-login",
|
|
1741
1742
|
version: "1.0.0-beta.1",
|
|
1742
1743
|
description: "Passwordless authentication via email one-time codes"
|
|
@@ -1938,7 +1939,7 @@ function createOTPLoginPlugin() {
|
|
|
1938
1939
|
error: "Account is deactivated"
|
|
1939
1940
|
}, 403);
|
|
1940
1941
|
}
|
|
1941
|
-
const token = await
|
|
1942
|
+
const token = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET);
|
|
1942
1943
|
cookie.setCookie(c, "auth_token", token, {
|
|
1943
1944
|
httpOnly: true,
|
|
1944
1945
|
secure: true,
|
|
@@ -2272,7 +2273,7 @@ var OAuthService = class {
|
|
|
2272
2273
|
var STATE_COOKIE_NAME = "oauth_state";
|
|
2273
2274
|
var STATE_COOKIE_MAX_AGE = 600;
|
|
2274
2275
|
function createOAuthProvidersPlugin() {
|
|
2275
|
-
const builder =
|
|
2276
|
+
const builder = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
2276
2277
|
name: "oauth-providers",
|
|
2277
2278
|
version: "1.0.0-beta.1",
|
|
2278
2279
|
description: "OAuth2/OIDC social login with GitHub, Google, and more"
|
|
@@ -2408,13 +2409,13 @@ function createOAuthProvidersPlugin() {
|
|
|
2408
2409
|
if (!user || !user.is_active) {
|
|
2409
2410
|
return c.redirect("/auth/login?error=Account is deactivated");
|
|
2410
2411
|
}
|
|
2411
|
-
const jwt2 = await
|
|
2412
|
+
const jwt2 = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
|
|
2412
2413
|
user.id,
|
|
2413
2414
|
user.email,
|
|
2414
2415
|
user.role,
|
|
2415
2416
|
c.env.JWT_SECRET
|
|
2416
2417
|
);
|
|
2417
|
-
|
|
2418
|
+
chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax" });
|
|
2418
2419
|
return c.redirect("/admin");
|
|
2419
2420
|
}
|
|
2420
2421
|
const existingUser = await oauthService.findUserByEmail(profile.email);
|
|
@@ -2431,13 +2432,13 @@ function createOAuthProvidersPlugin() {
|
|
|
2431
2432
|
tokenExpiresAt: tokenExpiresAt ?? void 0,
|
|
2432
2433
|
profileData: JSON.stringify(profile)
|
|
2433
2434
|
});
|
|
2434
|
-
const jwt2 = await
|
|
2435
|
+
const jwt2 = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
|
|
2435
2436
|
existingUser.id,
|
|
2436
2437
|
existingUser.email,
|
|
2437
2438
|
existingUser.role,
|
|
2438
2439
|
c.env.JWT_SECRET
|
|
2439
2440
|
);
|
|
2440
|
-
|
|
2441
|
+
chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax" });
|
|
2441
2442
|
return c.redirect("/admin");
|
|
2442
2443
|
}
|
|
2443
2444
|
const newUserId = await oauthService.createUserFromOAuth(profile);
|
|
@@ -2450,13 +2451,13 @@ function createOAuthProvidersPlugin() {
|
|
|
2450
2451
|
tokenExpiresAt: tokenExpiresAt ?? void 0,
|
|
2451
2452
|
profileData: JSON.stringify(profile)
|
|
2452
2453
|
});
|
|
2453
|
-
const jwt = await
|
|
2454
|
+
const jwt = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
|
|
2454
2455
|
newUserId,
|
|
2455
2456
|
profile.email.toLowerCase(),
|
|
2456
2457
|
"viewer",
|
|
2457
2458
|
c.env.JWT_SECRET
|
|
2458
2459
|
);
|
|
2459
|
-
|
|
2460
|
+
chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax" });
|
|
2460
2461
|
return c.redirect("/admin");
|
|
2461
2462
|
} catch (error) {
|
|
2462
2463
|
console.error("OAuth callback error:", error);
|
|
@@ -4138,7 +4139,7 @@ function renderSettingsPage(data) {
|
|
|
4138
4139
|
}, 30000);
|
|
4139
4140
|
</script>
|
|
4140
4141
|
`;
|
|
4141
|
-
return
|
|
4142
|
+
return chunkOHYBNCVL_cjs.renderAdminLayout({
|
|
4142
4143
|
title: "AI Search Settings",
|
|
4143
4144
|
pageTitle: "AI Search Settings",
|
|
4144
4145
|
currentPath: "/admin/plugins/ai-search/settings",
|
|
@@ -4149,7 +4150,7 @@ function renderSettingsPage(data) {
|
|
|
4149
4150
|
|
|
4150
4151
|
// src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
|
|
4151
4152
|
var adminRoutes = new hono.Hono();
|
|
4152
|
-
adminRoutes.use("*",
|
|
4153
|
+
adminRoutes.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
4153
4154
|
adminRoutes.get("/", async (c) => {
|
|
4154
4155
|
try {
|
|
4155
4156
|
const user = c.get("user");
|
|
@@ -4395,7 +4396,7 @@ var manifest_default = {
|
|
|
4395
4396
|
author: "SonicJS"};
|
|
4396
4397
|
|
|
4397
4398
|
// src/plugins/core-plugins/ai-search-plugin/index.ts
|
|
4398
|
-
var aiSearchPlugin = new
|
|
4399
|
+
var aiSearchPlugin = new chunk635JAMSE_cjs.PluginBuilder({
|
|
4399
4400
|
name: manifest_default.name,
|
|
4400
4401
|
version: manifest_default.version,
|
|
4401
4402
|
description: manifest_default.description,
|
|
@@ -4550,13 +4551,13 @@ function createMagicLinkAuthPlugin() {
|
|
|
4550
4551
|
SET used = 1, used_at = ?
|
|
4551
4552
|
WHERE id = ?
|
|
4552
4553
|
`).bind(Date.now(), magicLink.id).run();
|
|
4553
|
-
const jwtToken = await
|
|
4554
|
+
const jwtToken = await chunkUFPT5KCQ_cjs.AuthManager.generateToken(
|
|
4554
4555
|
user.id,
|
|
4555
4556
|
user.email,
|
|
4556
4557
|
user.role,
|
|
4557
4558
|
c.env.JWT_SECRET
|
|
4558
4559
|
);
|
|
4559
|
-
|
|
4560
|
+
chunkUFPT5KCQ_cjs.AuthManager.setAuthCookie(c, jwtToken);
|
|
4560
4561
|
await db.prepare(`
|
|
4561
4562
|
UPDATE users SET last_login_at = ? WHERE id = ?
|
|
4562
4563
|
`).bind(Date.now(), user.id).run();
|
|
@@ -4994,7 +4995,7 @@ var SecurityAuditService = class {
|
|
|
4994
4995
|
};
|
|
4995
4996
|
|
|
4996
4997
|
// src/plugins/core-plugins/security-audit-plugin/components/dashboard-page.ts
|
|
4997
|
-
|
|
4998
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
4998
4999
|
function formatTimestamp(ts) {
|
|
4999
5000
|
const date = new Date(ts);
|
|
5000
5001
|
const now = Date.now();
|
|
@@ -5193,11 +5194,11 @@ function renderSecurityDashboard(data) {
|
|
|
5193
5194
|
version,
|
|
5194
5195
|
dynamicMenuItems
|
|
5195
5196
|
};
|
|
5196
|
-
return
|
|
5197
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
5197
5198
|
}
|
|
5198
5199
|
|
|
5199
5200
|
// src/plugins/core-plugins/security-audit-plugin/components/event-log-page.ts
|
|
5200
|
-
|
|
5201
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
5201
5202
|
function formatTimestamp2(ts) {
|
|
5202
5203
|
const date = new Date(ts);
|
|
5203
5204
|
return date.toLocaleDateString("en-US", {
|
|
@@ -5404,11 +5405,11 @@ function renderEventLogPage(data) {
|
|
|
5404
5405
|
version,
|
|
5405
5406
|
dynamicMenuItems
|
|
5406
5407
|
};
|
|
5407
|
-
return
|
|
5408
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
5408
5409
|
}
|
|
5409
5410
|
|
|
5410
5411
|
// src/plugins/core-plugins/security-audit-plugin/components/settings-page.ts
|
|
5411
|
-
|
|
5412
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
5412
5413
|
function renderSecuritySettingsPage(data) {
|
|
5413
5414
|
const { settings, user, version, message, dynamicMenuItems } = data;
|
|
5414
5415
|
const content2 = `
|
|
@@ -5561,12 +5562,12 @@ function renderSecuritySettingsPage(data) {
|
|
|
5561
5562
|
version,
|
|
5562
5563
|
dynamicMenuItems
|
|
5563
5564
|
};
|
|
5564
|
-
return
|
|
5565
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
5565
5566
|
}
|
|
5566
5567
|
|
|
5567
5568
|
// src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
|
|
5568
5569
|
var adminRoutes2 = new hono.Hono();
|
|
5569
|
-
adminRoutes2.use("*",
|
|
5570
|
+
adminRoutes2.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
5570
5571
|
adminRoutes2.use("*", async (c, next) => {
|
|
5571
5572
|
const user = c.get("user");
|
|
5572
5573
|
if (user?.role !== "admin") {
|
|
@@ -5576,7 +5577,7 @@ adminRoutes2.use("*", async (c, next) => {
|
|
|
5576
5577
|
});
|
|
5577
5578
|
async function getSettings(db) {
|
|
5578
5579
|
try {
|
|
5579
|
-
const pluginService = new
|
|
5580
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
5580
5581
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
5581
5582
|
if (plugin2?.settings) {
|
|
5582
5583
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -5681,7 +5682,7 @@ adminRoutes2.post("/settings", async (c) => {
|
|
|
5681
5682
|
autoPurge: body["retention.autoPurge"] === "true"
|
|
5682
5683
|
}
|
|
5683
5684
|
};
|
|
5684
|
-
const pluginService = new
|
|
5685
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
5685
5686
|
await pluginService.updatePluginSettings("security-audit", settings);
|
|
5686
5687
|
if (c.req.header("HX-Request")) {
|
|
5687
5688
|
return c.json({ success: true });
|
|
@@ -5836,7 +5837,7 @@ var BruteForceDetector = class {
|
|
|
5836
5837
|
|
|
5837
5838
|
// src/plugins/core-plugins/security-audit-plugin/routes/api.ts
|
|
5838
5839
|
var apiRoutes2 = new hono.Hono();
|
|
5839
|
-
apiRoutes2.use("*",
|
|
5840
|
+
apiRoutes2.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
5840
5841
|
apiRoutes2.use("*", async (c, next) => {
|
|
5841
5842
|
const user = c.get("user");
|
|
5842
5843
|
if (user?.role !== "admin") {
|
|
@@ -5846,7 +5847,7 @@ apiRoutes2.use("*", async (c, next) => {
|
|
|
5846
5847
|
});
|
|
5847
5848
|
async function getSettings2(db) {
|
|
5848
5849
|
try {
|
|
5849
|
-
const pluginService = new
|
|
5850
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
5850
5851
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
5851
5852
|
if (plugin2?.settings) {
|
|
5852
5853
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -5994,7 +5995,7 @@ function generateFingerprint(ip, userAgent) {
|
|
|
5994
5995
|
}
|
|
5995
5996
|
async function getPluginSettings(db) {
|
|
5996
5997
|
try {
|
|
5997
|
-
const pluginService = new
|
|
5998
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
5998
5999
|
const plugin2 = await pluginService.getPlugin("security-audit");
|
|
5999
6000
|
if (plugin2?.settings) {
|
|
6000
6001
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6225,7 +6226,7 @@ async function logAuthEvent(c, db, settings, ip, userAgent, countryCode, fingerp
|
|
|
6225
6226
|
|
|
6226
6227
|
// src/plugins/core-plugins/security-audit-plugin/index.ts
|
|
6227
6228
|
function createSecurityAuditPlugin() {
|
|
6228
|
-
const builder =
|
|
6229
|
+
const builder = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
6229
6230
|
name: "security-audit",
|
|
6230
6231
|
version: "1.0.0-beta.1",
|
|
6231
6232
|
description: "Security event logging, brute-force detection, and analytics dashboard"
|
|
@@ -6323,6 +6324,33 @@ var SubscriptionService = class {
|
|
|
6323
6324
|
).first();
|
|
6324
6325
|
return this.mapRow(result);
|
|
6325
6326
|
}
|
|
6327
|
+
/**
|
|
6328
|
+
* Upsert a subscription by stripe_subscription_id (INSERT or UPDATE on conflict)
|
|
6329
|
+
*/
|
|
6330
|
+
async upsert(data) {
|
|
6331
|
+
const result = await this.db.prepare(`
|
|
6332
|
+
INSERT INTO subscriptions (user_id, stripe_customer_id, stripe_subscription_id, stripe_price_id, status, current_period_start, current_period_end, cancel_at_period_end)
|
|
6333
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
6334
|
+
ON CONFLICT(stripe_subscription_id) DO UPDATE SET
|
|
6335
|
+
status = excluded.status,
|
|
6336
|
+
stripe_price_id = excluded.stripe_price_id,
|
|
6337
|
+
current_period_start = excluded.current_period_start,
|
|
6338
|
+
current_period_end = excluded.current_period_end,
|
|
6339
|
+
cancel_at_period_end = excluded.cancel_at_period_end,
|
|
6340
|
+
updated_at = unixepoch()
|
|
6341
|
+
RETURNING *
|
|
6342
|
+
`).bind(
|
|
6343
|
+
data.userId,
|
|
6344
|
+
data.stripeCustomerId,
|
|
6345
|
+
data.stripeSubscriptionId,
|
|
6346
|
+
data.stripePriceId,
|
|
6347
|
+
data.status,
|
|
6348
|
+
data.currentPeriodStart,
|
|
6349
|
+
data.currentPeriodEnd,
|
|
6350
|
+
data.cancelAtPeriodEnd ? 1 : 0
|
|
6351
|
+
).first();
|
|
6352
|
+
return this.mapRow(result);
|
|
6353
|
+
}
|
|
6326
6354
|
/**
|
|
6327
6355
|
* Update a subscription by its Stripe subscription ID
|
|
6328
6356
|
*/
|
|
@@ -6477,24 +6505,183 @@ var SubscriptionService = class {
|
|
|
6477
6505
|
}
|
|
6478
6506
|
};
|
|
6479
6507
|
|
|
6508
|
+
// src/plugins/core-plugins/stripe-plugin/services/stripe-event-service.ts
|
|
6509
|
+
var StripeEventService = class {
|
|
6510
|
+
constructor(db) {
|
|
6511
|
+
this.db = db;
|
|
6512
|
+
}
|
|
6513
|
+
async ensureTable() {
|
|
6514
|
+
await this.db.prepare(`
|
|
6515
|
+
CREATE TABLE IF NOT EXISTS stripe_events (
|
|
6516
|
+
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
|
|
6517
|
+
stripe_event_id TEXT NOT NULL UNIQUE,
|
|
6518
|
+
type TEXT NOT NULL,
|
|
6519
|
+
object_id TEXT NOT NULL DEFAULT '',
|
|
6520
|
+
object_type TEXT NOT NULL DEFAULT '',
|
|
6521
|
+
data TEXT NOT NULL DEFAULT '{}',
|
|
6522
|
+
processed_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
|
6523
|
+
status TEXT NOT NULL DEFAULT 'processed',
|
|
6524
|
+
error TEXT
|
|
6525
|
+
)
|
|
6526
|
+
`).run();
|
|
6527
|
+
await this.db.prepare(`
|
|
6528
|
+
CREATE INDEX IF NOT EXISTS idx_stripe_events_type ON stripe_events(type)
|
|
6529
|
+
`).run();
|
|
6530
|
+
await this.db.prepare(`
|
|
6531
|
+
CREATE INDEX IF NOT EXISTS idx_stripe_events_status ON stripe_events(status)
|
|
6532
|
+
`).run();
|
|
6533
|
+
await this.db.prepare(`
|
|
6534
|
+
CREATE INDEX IF NOT EXISTS idx_stripe_events_processed_at ON stripe_events(processed_at DESC)
|
|
6535
|
+
`).run();
|
|
6536
|
+
}
|
|
6537
|
+
async log(event) {
|
|
6538
|
+
await this.db.prepare(`
|
|
6539
|
+
INSERT INTO stripe_events (stripe_event_id, type, object_id, object_type, data, status, error)
|
|
6540
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
6541
|
+
ON CONFLICT(stripe_event_id) DO UPDATE SET
|
|
6542
|
+
status = excluded.status,
|
|
6543
|
+
error = excluded.error,
|
|
6544
|
+
processed_at = unixepoch()
|
|
6545
|
+
`).bind(
|
|
6546
|
+
event.stripeEventId,
|
|
6547
|
+
event.type,
|
|
6548
|
+
event.objectId,
|
|
6549
|
+
event.objectType,
|
|
6550
|
+
JSON.stringify(event.data),
|
|
6551
|
+
event.status,
|
|
6552
|
+
event.error || null
|
|
6553
|
+
).run();
|
|
6554
|
+
}
|
|
6555
|
+
async list(filters = {}) {
|
|
6556
|
+
const where = [];
|
|
6557
|
+
const values = [];
|
|
6558
|
+
if (filters.type) {
|
|
6559
|
+
where.push("type = ?");
|
|
6560
|
+
values.push(filters.type);
|
|
6561
|
+
}
|
|
6562
|
+
if (filters.status) {
|
|
6563
|
+
where.push("status = ?");
|
|
6564
|
+
values.push(filters.status);
|
|
6565
|
+
}
|
|
6566
|
+
if (filters.objectId) {
|
|
6567
|
+
where.push("object_id = ?");
|
|
6568
|
+
values.push(filters.objectId);
|
|
6569
|
+
}
|
|
6570
|
+
const whereClause = where.length > 0 ? `WHERE ${where.join(" AND ")}` : "";
|
|
6571
|
+
const limit = Math.min(filters.limit || 50, 100);
|
|
6572
|
+
const page = filters.page || 1;
|
|
6573
|
+
const offset = (page - 1) * limit;
|
|
6574
|
+
const countResult = await this.db.prepare(
|
|
6575
|
+
`SELECT COUNT(*) as count FROM stripe_events ${whereClause}`
|
|
6576
|
+
).bind(...values).first();
|
|
6577
|
+
const results = await this.db.prepare(
|
|
6578
|
+
`SELECT * FROM stripe_events ${whereClause} ORDER BY processed_at DESC LIMIT ? OFFSET ?`
|
|
6579
|
+
).bind(...values, limit, offset).all();
|
|
6580
|
+
return {
|
|
6581
|
+
events: (results.results || []).map((r) => this.mapRow(r)),
|
|
6582
|
+
total: countResult?.count || 0
|
|
6583
|
+
};
|
|
6584
|
+
}
|
|
6585
|
+
async getStats() {
|
|
6586
|
+
const result = await this.db.prepare(`
|
|
6587
|
+
SELECT
|
|
6588
|
+
COUNT(*) as total,
|
|
6589
|
+
SUM(CASE WHEN status = 'processed' THEN 1 ELSE 0 END) as processed,
|
|
6590
|
+
SUM(CASE WHEN status = 'failed' THEN 1 ELSE 0 END) as failed,
|
|
6591
|
+
SUM(CASE WHEN status = 'ignored' THEN 1 ELSE 0 END) as ignored
|
|
6592
|
+
FROM stripe_events
|
|
6593
|
+
`).first();
|
|
6594
|
+
return {
|
|
6595
|
+
total: result?.total || 0,
|
|
6596
|
+
processed: result?.processed || 0,
|
|
6597
|
+
failed: result?.failed || 0,
|
|
6598
|
+
ignored: result?.ignored || 0
|
|
6599
|
+
};
|
|
6600
|
+
}
|
|
6601
|
+
async getDistinctTypes() {
|
|
6602
|
+
const results = await this.db.prepare(
|
|
6603
|
+
"SELECT DISTINCT type FROM stripe_events ORDER BY type"
|
|
6604
|
+
).all();
|
|
6605
|
+
return (results.results || []).map((r) => r.type);
|
|
6606
|
+
}
|
|
6607
|
+
mapRow(row) {
|
|
6608
|
+
return {
|
|
6609
|
+
id: row.id,
|
|
6610
|
+
stripeEventId: row.stripe_event_id,
|
|
6611
|
+
type: row.type,
|
|
6612
|
+
objectId: row.object_id,
|
|
6613
|
+
objectType: row.object_type,
|
|
6614
|
+
data: row.data,
|
|
6615
|
+
processedAt: row.processed_at,
|
|
6616
|
+
status: row.status,
|
|
6617
|
+
error: row.error || void 0
|
|
6618
|
+
};
|
|
6619
|
+
}
|
|
6620
|
+
};
|
|
6621
|
+
|
|
6480
6622
|
// src/plugins/core-plugins/stripe-plugin/components/subscriptions-page.ts
|
|
6481
|
-
|
|
6623
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
6624
|
+
|
|
6625
|
+
// src/plugins/core-plugins/stripe-plugin/components/tab-bar.ts
|
|
6626
|
+
var TABS = [
|
|
6627
|
+
{ label: "Subscriptions", path: "/admin/plugins/stripe" },
|
|
6628
|
+
{ label: "Events", path: "/admin/plugins/stripe/events" },
|
|
6629
|
+
{ label: "Settings", path: "/admin/plugins/stripe/settings" }
|
|
6630
|
+
];
|
|
6631
|
+
function renderStripeTabBar(currentPath) {
|
|
6632
|
+
const tabs = TABS.map((tab) => {
|
|
6633
|
+
const isActive = currentPath === tab.path || tab.path === "/admin/plugins/stripe" && currentPath === "/admin/plugins/stripe/";
|
|
6634
|
+
return `
|
|
6635
|
+
<a href="${tab.path}"
|
|
6636
|
+
class="${isActive ? "border-cyan-500 text-zinc-950 dark:text-white" : "border-transparent text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 hover:border-zinc-300 dark:hover:border-zinc-600"} whitespace-nowrap border-b-2 px-4 py-3 text-sm font-medium transition-colors">
|
|
6637
|
+
${tab.label}
|
|
6638
|
+
</a>`;
|
|
6639
|
+
}).join("");
|
|
6482
6640
|
return `
|
|
6483
|
-
<div class="
|
|
6641
|
+
<div class="border-b border-zinc-950/5 dark:border-white/10 mb-6">
|
|
6642
|
+
<nav class="-mb-px flex gap-x-2" aria-label="Stripe tabs">
|
|
6643
|
+
${tabs}
|
|
6644
|
+
</nav>
|
|
6645
|
+
</div>
|
|
6646
|
+
`;
|
|
6647
|
+
}
|
|
6648
|
+
|
|
6649
|
+
// src/plugins/core-plugins/stripe-plugin/components/subscriptions-page.ts
|
|
6650
|
+
function renderSubscriptionsPage(data) {
|
|
6651
|
+
const { subscriptions, stats, filters, user, version, dynamicMenuItems } = data;
|
|
6652
|
+
const content2 = `
|
|
6653
|
+
<div>
|
|
6654
|
+
<div class="sm:flex sm:items-center sm:justify-between mb-6">
|
|
6655
|
+
<div class="sm:flex-auto">
|
|
6656
|
+
<h1 class="text-2xl/8 font-semibold text-zinc-950 dark:text-white sm:text-xl/8">Stripe</h1>
|
|
6657
|
+
<p class="mt-2 text-sm/6 text-zinc-500 dark:text-zinc-400">
|
|
6658
|
+
Manage subscriptions, view billing status, and monitor payment events.
|
|
6659
|
+
</p>
|
|
6660
|
+
</div>
|
|
6661
|
+
<div class="mt-4 sm:mt-0 sm:ml-16">
|
|
6662
|
+
<button id="sync-btn" onclick="syncSubscriptions()"
|
|
6663
|
+
class="inline-flex items-center justify-center rounded-lg bg-zinc-950 dark:bg-white px-3.5 py-2.5 text-sm font-semibold text-white dark:text-zinc-950 hover:bg-zinc-800 dark:hover:bg-zinc-100 transition-colors shadow-sm">
|
|
6664
|
+
Sync from Stripe
|
|
6665
|
+
</button>
|
|
6666
|
+
</div>
|
|
6667
|
+
</div>
|
|
6668
|
+
|
|
6669
|
+
${renderStripeTabBar("/admin/plugins/stripe")}
|
|
6670
|
+
|
|
6484
6671
|
<!-- Stats Cards -->
|
|
6485
|
-
<div class="grid grid-cols-1
|
|
6486
|
-
${statsCard("Total", stats.total, "text-
|
|
6487
|
-
${statsCard("Active", stats.active, "text-
|
|
6488
|
-
${statsCard("Trialing", stats.trialing, "text-blue-600")}
|
|
6489
|
-
${statsCard("Past Due", stats.pastDue, "text-
|
|
6490
|
-
${statsCard("Canceled", stats.canceled, "text-red-600")}
|
|
6672
|
+
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5 mb-6">
|
|
6673
|
+
${statsCard("Total", stats.total, "text-zinc-950 dark:text-white")}
|
|
6674
|
+
${statsCard("Active", stats.active, "text-emerald-600 dark:text-emerald-400")}
|
|
6675
|
+
${statsCard("Trialing", stats.trialing, "text-blue-600 dark:text-blue-400")}
|
|
6676
|
+
${statsCard("Past Due", stats.pastDue, "text-amber-600 dark:text-amber-400")}
|
|
6677
|
+
${statsCard("Canceled", stats.canceled, "text-red-600 dark:text-red-400")}
|
|
6491
6678
|
</div>
|
|
6492
6679
|
|
|
6493
6680
|
<!-- Filters -->
|
|
6494
|
-
<div class="bg-white
|
|
6681
|
+
<div class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl p-4 ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm mb-6">
|
|
6495
6682
|
<form method="GET" class="flex items-center gap-4">
|
|
6496
|
-
<label class="text-sm font-medium text-
|
|
6497
|
-
<select name="status" class="border
|
|
6683
|
+
<label class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Status:</label>
|
|
6684
|
+
<select name="status" class="rounded-lg border-0 bg-white dark:bg-zinc-800 px-3 py-1.5 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10" onchange="this.form.submit()">
|
|
6498
6685
|
<option value="">All</option>
|
|
6499
6686
|
${statusOption("active", filters.status)}
|
|
6500
6687
|
${statusOption("trialing", filters.status)}
|
|
@@ -6507,33 +6694,72 @@ function renderSubscriptionsPage(subscriptions, stats, filters) {
|
|
|
6507
6694
|
</div>
|
|
6508
6695
|
|
|
6509
6696
|
<!-- Subscriptions Table -->
|
|
6510
|
-
<div class="bg-white
|
|
6511
|
-
<table class="min-w-full divide-y divide-
|
|
6512
|
-
<thead
|
|
6697
|
+
<div class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm overflow-hidden">
|
|
6698
|
+
<table class="min-w-full divide-y divide-zinc-950/5 dark:divide-white/5">
|
|
6699
|
+
<thead>
|
|
6513
6700
|
<tr>
|
|
6514
|
-
<th class="px-6 py-3 text-left text-xs font-medium text-
|
|
6515
|
-
<th class="px-6 py-3 text-left text-xs font-medium text-
|
|
6516
|
-
<th class="px-6 py-3 text-left text-xs font-medium text-
|
|
6517
|
-
<th class="px-6 py-3 text-left text-xs font-medium text-
|
|
6518
|
-
<th class="px-6 py-3 text-left text-xs font-medium text-
|
|
6519
|
-
<th class="px-6 py-3 text-left text-xs font-medium text-
|
|
6701
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">User</th>
|
|
6702
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Status</th>
|
|
6703
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Price ID</th>
|
|
6704
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Current Period</th>
|
|
6705
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Cancel at End</th>
|
|
6706
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Stripe</th>
|
|
6520
6707
|
</tr>
|
|
6521
6708
|
</thead>
|
|
6522
|
-
<tbody class="
|
|
6523
|
-
${subscriptions.length === 0 ? '<tr><td colspan="6" class="px-6 py-8 text-center text-
|
|
6709
|
+
<tbody class="divide-y divide-zinc-950/5 dark:divide-white/5">
|
|
6710
|
+
${subscriptions.length === 0 ? '<tr><td colspan="6" class="px-6 py-8 text-center text-zinc-500 dark:text-zinc-400">No subscriptions found</td></tr>' : subscriptions.map(renderRow).join("")}
|
|
6524
6711
|
</tbody>
|
|
6525
6712
|
</table>
|
|
6526
6713
|
|
|
6527
6714
|
${renderPagination2(filters.page, filters.totalPages, filters.status)}
|
|
6528
6715
|
</div>
|
|
6716
|
+
|
|
6717
|
+
<div id="sync-message" class="hidden mt-4 rounded-lg p-4 text-sm"></div>
|
|
6529
6718
|
</div>
|
|
6719
|
+
|
|
6720
|
+
<script>
|
|
6721
|
+
async function syncSubscriptions() {
|
|
6722
|
+
const btn = document.getElementById('sync-btn')
|
|
6723
|
+
const msg = document.getElementById('sync-message')
|
|
6724
|
+
btn.disabled = true
|
|
6725
|
+
btn.textContent = 'Syncing...'
|
|
6726
|
+
msg.className = 'hidden mt-4 rounded-lg p-4 text-sm'
|
|
6727
|
+
try {
|
|
6728
|
+
const res = await fetch('/api/stripe/sync-subscriptions', { method: 'POST' })
|
|
6729
|
+
const result = await res.json()
|
|
6730
|
+
if (result.success) {
|
|
6731
|
+
msg.className = 'mt-4 rounded-lg p-4 text-sm bg-emerald-400/10 text-emerald-500 dark:text-emerald-400 ring-1 ring-inset ring-emerald-400/20'
|
|
6732
|
+
msg.textContent = 'Synced ' + result.synced + ' of ' + result.total + ' subscriptions from Stripe.' + (result.errors > 0 ? ' (' + result.errors + ' errors)' : '')
|
|
6733
|
+
setTimeout(() => location.reload(), 1500)
|
|
6734
|
+
} else {
|
|
6735
|
+
msg.className = 'mt-4 rounded-lg p-4 text-sm bg-red-400/10 text-red-500 dark:text-red-400 ring-1 ring-inset ring-red-400/20'
|
|
6736
|
+
msg.textContent = result.error || 'Sync failed.'
|
|
6737
|
+
}
|
|
6738
|
+
} catch {
|
|
6739
|
+
msg.className = 'mt-4 rounded-lg p-4 text-sm bg-red-400/10 text-red-500 dark:text-red-400 ring-1 ring-inset ring-red-400/20'
|
|
6740
|
+
msg.textContent = 'Network error. Please try again.'
|
|
6741
|
+
}
|
|
6742
|
+
btn.disabled = false
|
|
6743
|
+
btn.textContent = 'Sync from Stripe'
|
|
6744
|
+
}
|
|
6745
|
+
</script>
|
|
6530
6746
|
`;
|
|
6747
|
+
const layoutData = {
|
|
6748
|
+
title: "Stripe Subscriptions",
|
|
6749
|
+
pageTitle: "Stripe Subscriptions",
|
|
6750
|
+
currentPath: "/admin/plugins/stripe",
|
|
6751
|
+
user,
|
|
6752
|
+
content: content2,
|
|
6753
|
+
version,
|
|
6754
|
+
dynamicMenuItems
|
|
6755
|
+
};
|
|
6756
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
6531
6757
|
}
|
|
6532
6758
|
function statsCard(label, value, colorClass) {
|
|
6533
6759
|
return `
|
|
6534
|
-
<div class="bg-white
|
|
6535
|
-
<
|
|
6536
|
-
<
|
|
6760
|
+
<div class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl p-5 ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm">
|
|
6761
|
+
<p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">${label}</p>
|
|
6762
|
+
<p class="mt-2 text-3xl font-bold ${colorClass}">${value}</p>
|
|
6537
6763
|
</div>
|
|
6538
6764
|
`;
|
|
6539
6765
|
}
|
|
@@ -6544,18 +6770,18 @@ function statusOption(value, current) {
|
|
|
6544
6770
|
}
|
|
6545
6771
|
function statusBadge(status) {
|
|
6546
6772
|
const colors = {
|
|
6547
|
-
active: "bg-
|
|
6548
|
-
trialing: "bg-blue-
|
|
6549
|
-
past_due: "bg-
|
|
6550
|
-
canceled: "bg-red-
|
|
6551
|
-
unpaid: "bg-orange-
|
|
6552
|
-
paused: "bg-
|
|
6553
|
-
incomplete: "bg-
|
|
6554
|
-
incomplete_expired: "bg-red-
|
|
6773
|
+
active: "bg-emerald-400/10 text-emerald-500 dark:text-emerald-400 ring-emerald-400/20",
|
|
6774
|
+
trialing: "bg-blue-400/10 text-blue-500 dark:text-blue-400 ring-blue-400/20",
|
|
6775
|
+
past_due: "bg-amber-400/10 text-amber-500 dark:text-amber-400 ring-amber-400/20",
|
|
6776
|
+
canceled: "bg-red-400/10 text-red-500 dark:text-red-400 ring-red-400/20",
|
|
6777
|
+
unpaid: "bg-orange-400/10 text-orange-500 dark:text-orange-400 ring-orange-400/20",
|
|
6778
|
+
paused: "bg-zinc-400/10 text-zinc-500 dark:text-zinc-400 ring-zinc-400/20",
|
|
6779
|
+
incomplete: "bg-zinc-400/10 text-zinc-500 dark:text-zinc-400 ring-zinc-400/20",
|
|
6780
|
+
incomplete_expired: "bg-red-400/10 text-red-500 dark:text-red-400 ring-red-400/20"
|
|
6555
6781
|
};
|
|
6556
|
-
const color = colors[status] || "bg-
|
|
6782
|
+
const color = colors[status] || "bg-zinc-400/10 text-zinc-500 ring-zinc-400/20";
|
|
6557
6783
|
const label = status.replace("_", " ");
|
|
6558
|
-
return `<span class="inline-flex items-center px-2
|
|
6784
|
+
return `<span class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ring-1 ring-inset ${color}">${label}</span>`;
|
|
6559
6785
|
}
|
|
6560
6786
|
function formatDate(timestamp) {
|
|
6561
6787
|
if (!timestamp) return "-";
|
|
@@ -6567,23 +6793,23 @@ function formatDate(timestamp) {
|
|
|
6567
6793
|
}
|
|
6568
6794
|
function renderRow(sub) {
|
|
6569
6795
|
return `
|
|
6570
|
-
<tr>
|
|
6796
|
+
<tr class="hover:bg-zinc-950/[0.025] dark:hover:bg-white/[0.025]">
|
|
6571
6797
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
6572
|
-
<div class="text-sm font-medium text-
|
|
6573
|
-
<div class="text-xs text-
|
|
6798
|
+
<div class="text-sm font-medium text-zinc-950 dark:text-white">${sub.userEmail || sub.userId}</div>
|
|
6799
|
+
<div class="text-xs text-zinc-500 dark:text-zinc-400">${sub.stripeCustomerId}</div>
|
|
6574
6800
|
</td>
|
|
6575
6801
|
<td class="px-6 py-4 whitespace-nowrap">${statusBadge(sub.status)}</td>
|
|
6576
|
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-
|
|
6577
|
-
<td class="px-6 py-4 whitespace-nowrap text-sm text-
|
|
6802
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-zinc-500 dark:text-zinc-400">${sub.stripePriceId}</td>
|
|
6803
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-zinc-500 dark:text-zinc-400">
|
|
6578
6804
|
${formatDate(sub.currentPeriodStart)} - ${formatDate(sub.currentPeriodEnd)}
|
|
6579
6805
|
</td>
|
|
6580
6806
|
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
|
6581
|
-
${sub.cancelAtPeriodEnd ? '<span class="text-
|
|
6807
|
+
${sub.cancelAtPeriodEnd ? '<span class="text-amber-500 dark:text-amber-400 font-medium">Yes</span>' : '<span class="text-zinc-400 dark:text-zinc-500">No</span>'}
|
|
6582
6808
|
</td>
|
|
6583
6809
|
<td class="px-6 py-4 whitespace-nowrap text-sm">
|
|
6584
6810
|
<a href="https://dashboard.stripe.com/subscriptions/${sub.stripeSubscriptionId}"
|
|
6585
6811
|
target="_blank" rel="noopener noreferrer"
|
|
6586
|
-
class="text-
|
|
6812
|
+
class="text-cyan-600 dark:text-cyan-400 hover:text-cyan-500 dark:hover:text-cyan-300">
|
|
6587
6813
|
View in Stripe
|
|
6588
6814
|
</a>
|
|
6589
6815
|
</td>
|
|
@@ -6594,13 +6820,161 @@ function renderPagination2(page, totalPages, status) {
|
|
|
6594
6820
|
if (totalPages <= 1) return "";
|
|
6595
6821
|
const params = status ? `&status=${status}` : "";
|
|
6596
6822
|
return `
|
|
6597
|
-
<div class="
|
|
6598
|
-
<div class="text-sm text-
|
|
6823
|
+
<div class="px-6 py-3 flex items-center justify-between border-t border-zinc-950/5 dark:border-white/5">
|
|
6824
|
+
<div class="text-sm text-zinc-500 dark:text-zinc-400">
|
|
6599
6825
|
Page ${page} of ${totalPages}
|
|
6600
6826
|
</div>
|
|
6601
6827
|
<div class="flex gap-2">
|
|
6602
|
-
${page > 1 ? `<a href="?page=${page - 1}${params}" class="px-3 py-1
|
|
6603
|
-
${page < totalPages ? `<a href="?page=${page + 1}${params}" class="px-3 py-1
|
|
6828
|
+
${page > 1 ? `<a href="?page=${page - 1}${params}" class="px-3 py-1 rounded-lg text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-800">Previous</a>` : ""}
|
|
6829
|
+
${page < totalPages ? `<a href="?page=${page + 1}${params}" class="px-3 py-1 rounded-lg text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-800">Next</a>` : ""}
|
|
6830
|
+
</div>
|
|
6831
|
+
</div>
|
|
6832
|
+
`;
|
|
6833
|
+
}
|
|
6834
|
+
|
|
6835
|
+
// src/plugins/core-plugins/stripe-plugin/components/events-page.ts
|
|
6836
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
6837
|
+
function renderEventsPage(data) {
|
|
6838
|
+
const { events, stats, types, filters, user, version, dynamicMenuItems } = data;
|
|
6839
|
+
const content2 = `
|
|
6840
|
+
<div>
|
|
6841
|
+
<div class="sm:flex sm:items-center sm:justify-between mb-6">
|
|
6842
|
+
<div class="sm:flex-auto">
|
|
6843
|
+
<h1 class="text-2xl/8 font-semibold text-zinc-950 dark:text-white sm:text-xl/8">Stripe</h1>
|
|
6844
|
+
<p class="mt-2 text-sm/6 text-zinc-500 dark:text-zinc-400">
|
|
6845
|
+
Webhook event log showing all processed, failed, and ignored Stripe events.
|
|
6846
|
+
</p>
|
|
6847
|
+
</div>
|
|
6848
|
+
</div>
|
|
6849
|
+
|
|
6850
|
+
${renderStripeTabBar("/admin/plugins/stripe/events")}
|
|
6851
|
+
|
|
6852
|
+
<!-- Stats Cards -->
|
|
6853
|
+
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4 mb-6">
|
|
6854
|
+
${eventStatsCard("Total Events", stats.total, "text-zinc-950 dark:text-white")}
|
|
6855
|
+
${eventStatsCard("Processed", stats.processed, "text-emerald-600 dark:text-emerald-400")}
|
|
6856
|
+
${eventStatsCard("Failed", stats.failed, "text-red-600 dark:text-red-400")}
|
|
6857
|
+
${eventStatsCard("Ignored", stats.ignored, "text-zinc-500 dark:text-zinc-400")}
|
|
6858
|
+
</div>
|
|
6859
|
+
|
|
6860
|
+
<!-- Filters -->
|
|
6861
|
+
<div class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl p-4 ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm mb-6">
|
|
6862
|
+
<form method="GET" class="flex items-center gap-4 flex-wrap">
|
|
6863
|
+
<label class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Type:</label>
|
|
6864
|
+
<select name="type" class="rounded-lg border-0 bg-white dark:bg-zinc-800 px-3 py-1.5 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10" onchange="this.form.submit()">
|
|
6865
|
+
<option value="">All</option>
|
|
6866
|
+
${types.map((t) => `<option value="${t}" ${t === filters.type ? "selected" : ""}>${t}</option>`).join("")}
|
|
6867
|
+
</select>
|
|
6868
|
+
|
|
6869
|
+
<label class="text-sm font-medium text-zinc-500 dark:text-zinc-400">Status:</label>
|
|
6870
|
+
<select name="status" class="rounded-lg border-0 bg-white dark:bg-zinc-800 px-3 py-1.5 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10" onchange="this.form.submit()">
|
|
6871
|
+
<option value="">All</option>
|
|
6872
|
+
${eventStatusOption("processed", filters.status)}
|
|
6873
|
+
${eventStatusOption("failed", filters.status)}
|
|
6874
|
+
${eventStatusOption("ignored", filters.status)}
|
|
6875
|
+
</select>
|
|
6876
|
+
</form>
|
|
6877
|
+
</div>
|
|
6878
|
+
|
|
6879
|
+
<!-- Events Table -->
|
|
6880
|
+
<div class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm overflow-hidden">
|
|
6881
|
+
<table class="min-w-full divide-y divide-zinc-950/5 dark:divide-white/5">
|
|
6882
|
+
<thead>
|
|
6883
|
+
<tr>
|
|
6884
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Time</th>
|
|
6885
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Type</th>
|
|
6886
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Object</th>
|
|
6887
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Status</th>
|
|
6888
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Event ID</th>
|
|
6889
|
+
</tr>
|
|
6890
|
+
</thead>
|
|
6891
|
+
<tbody class="divide-y divide-zinc-950/5 dark:divide-white/5">
|
|
6892
|
+
${events.length === 0 ? '<tr><td colspan="5" class="px-6 py-8 text-center text-zinc-500 dark:text-zinc-400">No events recorded yet</td></tr>' : events.map(renderEventRow).join("")}
|
|
6893
|
+
</tbody>
|
|
6894
|
+
</table>
|
|
6895
|
+
|
|
6896
|
+
${renderEventPagination(filters.page, filters.totalPages, filters.type, filters.status)}
|
|
6897
|
+
</div>
|
|
6898
|
+
</div>
|
|
6899
|
+
`;
|
|
6900
|
+
const layoutData = {
|
|
6901
|
+
title: "Stripe Events",
|
|
6902
|
+
pageTitle: "Stripe Events",
|
|
6903
|
+
currentPath: "/admin/plugins/stripe",
|
|
6904
|
+
user,
|
|
6905
|
+
content: content2,
|
|
6906
|
+
version,
|
|
6907
|
+
dynamicMenuItems
|
|
6908
|
+
};
|
|
6909
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
6910
|
+
}
|
|
6911
|
+
function eventStatsCard(label, value, colorClass) {
|
|
6912
|
+
return `
|
|
6913
|
+
<div class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl p-5 ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm">
|
|
6914
|
+
<p class="text-sm font-medium text-zinc-500 dark:text-zinc-400">${label}</p>
|
|
6915
|
+
<p class="mt-2 text-3xl font-bold ${colorClass}">${value}</p>
|
|
6916
|
+
</div>
|
|
6917
|
+
`;
|
|
6918
|
+
}
|
|
6919
|
+
function eventStatusOption(value, current) {
|
|
6920
|
+
const selected = value === current ? "selected" : "";
|
|
6921
|
+
const label = value.charAt(0).toUpperCase() + value.slice(1);
|
|
6922
|
+
return `<option value="${value}" ${selected}>${label}</option>`;
|
|
6923
|
+
}
|
|
6924
|
+
function eventStatusBadge(status) {
|
|
6925
|
+
const colors = {
|
|
6926
|
+
processed: "bg-emerald-400/10 text-emerald-500 dark:text-emerald-400 ring-emerald-400/20",
|
|
6927
|
+
failed: "bg-red-400/10 text-red-500 dark:text-red-400 ring-red-400/20",
|
|
6928
|
+
ignored: "bg-zinc-400/10 text-zinc-500 dark:text-zinc-400 ring-zinc-400/20"
|
|
6929
|
+
};
|
|
6930
|
+
const color = colors[status] || "bg-zinc-400/10 text-zinc-500 ring-zinc-400/20";
|
|
6931
|
+
return `<span class="inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ring-1 ring-inset ${color}">${status}</span>`;
|
|
6932
|
+
}
|
|
6933
|
+
function formatTimestamp3(timestamp) {
|
|
6934
|
+
if (!timestamp) return "-";
|
|
6935
|
+
const d = new Date(timestamp * 1e3);
|
|
6936
|
+
return d.toLocaleString("en-US", {
|
|
6937
|
+
month: "short",
|
|
6938
|
+
day: "numeric",
|
|
6939
|
+
year: "numeric",
|
|
6940
|
+
hour: "2-digit",
|
|
6941
|
+
minute: "2-digit",
|
|
6942
|
+
second: "2-digit"
|
|
6943
|
+
});
|
|
6944
|
+
}
|
|
6945
|
+
function renderEventRow(event) {
|
|
6946
|
+
const errorTooltip = event.error ? ` title="${event.error.replace(/"/g, """)}"` : "";
|
|
6947
|
+
return `
|
|
6948
|
+
<tr class="hover:bg-zinc-950/[0.025] dark:hover:bg-white/[0.025]"${errorTooltip}>
|
|
6949
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-zinc-500 dark:text-zinc-400">
|
|
6950
|
+
${formatTimestamp3(event.processedAt)}
|
|
6951
|
+
</td>
|
|
6952
|
+
<td class="px-6 py-4 whitespace-nowrap">
|
|
6953
|
+
<span class="text-sm font-mono text-zinc-950 dark:text-white">${event.type}</span>
|
|
6954
|
+
</td>
|
|
6955
|
+
<td class="px-6 py-4 whitespace-nowrap">
|
|
6956
|
+
<div class="text-sm font-mono text-zinc-500 dark:text-zinc-400">${event.objectId || "-"}</div>
|
|
6957
|
+
<div class="text-xs text-zinc-400 dark:text-zinc-500">${event.objectType}</div>
|
|
6958
|
+
</td>
|
|
6959
|
+
<td class="px-6 py-4 whitespace-nowrap">${eventStatusBadge(event.status)}</td>
|
|
6960
|
+
<td class="px-6 py-4 whitespace-nowrap text-xs font-mono text-zinc-400 dark:text-zinc-500">${event.stripeEventId}</td>
|
|
6961
|
+
</tr>
|
|
6962
|
+
`;
|
|
6963
|
+
}
|
|
6964
|
+
function renderEventPagination(page, totalPages, type, status) {
|
|
6965
|
+
if (totalPages <= 1) return "";
|
|
6966
|
+
const params = [];
|
|
6967
|
+
if (type) params.push(`type=${type}`);
|
|
6968
|
+
if (status) params.push(`status=${status}`);
|
|
6969
|
+
const extra = params.length > 0 ? `&${params.join("&")}` : "";
|
|
6970
|
+
return `
|
|
6971
|
+
<div class="px-6 py-3 flex items-center justify-between border-t border-zinc-950/5 dark:border-white/5">
|
|
6972
|
+
<div class="text-sm text-zinc-500 dark:text-zinc-400">
|
|
6973
|
+
Page ${page} of ${totalPages}
|
|
6974
|
+
</div>
|
|
6975
|
+
<div class="flex gap-2">
|
|
6976
|
+
${page > 1 ? `<a href="?page=${page - 1}${extra}" class="px-3 py-1 rounded-lg text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-800">Previous</a>` : ""}
|
|
6977
|
+
${page < totalPages ? `<a href="?page=${page + 1}${extra}" class="px-3 py-1 rounded-lg text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-800">Next</a>` : ""}
|
|
6604
6978
|
</div>
|
|
6605
6979
|
</div>
|
|
6606
6980
|
`;
|
|
@@ -6608,6 +6982,7 @@ function renderPagination2(page, totalPages, status) {
|
|
|
6608
6982
|
|
|
6609
6983
|
// src/plugins/core-plugins/stripe-plugin/types.ts
|
|
6610
6984
|
var DEFAULT_SETTINGS3 = {
|
|
6985
|
+
stripePublishableKey: "",
|
|
6611
6986
|
stripeSecretKey: "",
|
|
6612
6987
|
stripeWebhookSecret: "",
|
|
6613
6988
|
stripePriceId: "",
|
|
@@ -6617,7 +6992,7 @@ var DEFAULT_SETTINGS3 = {
|
|
|
6617
6992
|
|
|
6618
6993
|
// src/plugins/core-plugins/stripe-plugin/routes/admin.ts
|
|
6619
6994
|
var adminRoutes3 = new hono.Hono();
|
|
6620
|
-
adminRoutes3.use("*",
|
|
6995
|
+
adminRoutes3.use("*", chunkUFPT5KCQ_cjs.requireAuth());
|
|
6621
6996
|
adminRoutes3.use("*", async (c, next) => {
|
|
6622
6997
|
const user = c.get("user");
|
|
6623
6998
|
if (user?.role !== "admin") {
|
|
@@ -6625,8 +7000,21 @@ adminRoutes3.use("*", async (c, next) => {
|
|
|
6625
7000
|
}
|
|
6626
7001
|
return next();
|
|
6627
7002
|
});
|
|
7003
|
+
async function getSettings3(db) {
|
|
7004
|
+
try {
|
|
7005
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
7006
|
+
const plugin2 = await pluginService.getPlugin("stripe");
|
|
7007
|
+
if (plugin2?.settings) {
|
|
7008
|
+
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
7009
|
+
return { ...DEFAULT_SETTINGS3, ...settings };
|
|
7010
|
+
}
|
|
7011
|
+
} catch {
|
|
7012
|
+
}
|
|
7013
|
+
return DEFAULT_SETTINGS3;
|
|
7014
|
+
}
|
|
6628
7015
|
adminRoutes3.get("/", async (c) => {
|
|
6629
7016
|
const db = c.env.DB;
|
|
7017
|
+
const user = c.get("user");
|
|
6630
7018
|
const subscriptionService = new SubscriptionService(db);
|
|
6631
7019
|
await subscriptionService.ensureTable();
|
|
6632
7020
|
const page = parseInt(c.req.query("page") || "1");
|
|
@@ -6637,13 +7025,152 @@ adminRoutes3.get("/", async (c) => {
|
|
|
6637
7025
|
subscriptionService.getStats()
|
|
6638
7026
|
]);
|
|
6639
7027
|
const totalPages = Math.ceil(total / limit);
|
|
6640
|
-
const html = renderSubscriptionsPage(
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
totalPages
|
|
7028
|
+
const html = renderSubscriptionsPage({
|
|
7029
|
+
subscriptions,
|
|
7030
|
+
stats,
|
|
7031
|
+
filters: { status: statusFilter, page, totalPages },
|
|
7032
|
+
user: user ? { name: user.email, email: user.email, role: user.role } : void 0,
|
|
7033
|
+
version: c.get("appVersion"),
|
|
7034
|
+
dynamicMenuItems: c.get("pluginMenuItems")
|
|
6644
7035
|
});
|
|
6645
7036
|
return c.html(html);
|
|
6646
7037
|
});
|
|
7038
|
+
adminRoutes3.get("/events", async (c) => {
|
|
7039
|
+
const db = c.env.DB;
|
|
7040
|
+
const user = c.get("user");
|
|
7041
|
+
const eventService = new StripeEventService(db);
|
|
7042
|
+
await eventService.ensureTable();
|
|
7043
|
+
const page = parseInt(c.req.query("page") || "1");
|
|
7044
|
+
const limit = 50;
|
|
7045
|
+
const typeFilter = c.req.query("type") || void 0;
|
|
7046
|
+
const statusFilter = c.req.query("status");
|
|
7047
|
+
const [{ events, total }, stats, types] = await Promise.all([
|
|
7048
|
+
eventService.list({ type: typeFilter, status: statusFilter, page, limit }),
|
|
7049
|
+
eventService.getStats(),
|
|
7050
|
+
eventService.getDistinctTypes()
|
|
7051
|
+
]);
|
|
7052
|
+
const totalPages = Math.ceil(total / limit);
|
|
7053
|
+
const html = renderEventsPage({
|
|
7054
|
+
events,
|
|
7055
|
+
stats,
|
|
7056
|
+
types,
|
|
7057
|
+
filters: { type: typeFilter, status: statusFilter, page, totalPages },
|
|
7058
|
+
user: user ? { name: user.email, email: user.email, role: user.role } : void 0,
|
|
7059
|
+
version: c.get("appVersion"),
|
|
7060
|
+
dynamicMenuItems: c.get("pluginMenuItems")
|
|
7061
|
+
});
|
|
7062
|
+
return c.html(html);
|
|
7063
|
+
});
|
|
7064
|
+
adminRoutes3.get("/settings", async (c) => {
|
|
7065
|
+
const db = c.env.DB;
|
|
7066
|
+
const user = c.get("user");
|
|
7067
|
+
const settings = await getSettings3(db);
|
|
7068
|
+
const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-HFD37TY5.cjs');
|
|
7069
|
+
const content2 = `
|
|
7070
|
+
<div>
|
|
7071
|
+
<div class="mb-6">
|
|
7072
|
+
<h1 class="text-2xl/8 font-semibold text-zinc-950 dark:text-white sm:text-xl/8">Stripe</h1>
|
|
7073
|
+
<p class="mt-2 text-sm/6 text-zinc-500 dark:text-zinc-400">
|
|
7074
|
+
Configure your Stripe API keys and checkout options.
|
|
7075
|
+
</p>
|
|
7076
|
+
</div>
|
|
7077
|
+
|
|
7078
|
+
${renderStripeTabBar("/admin/plugins/stripe/settings")}
|
|
7079
|
+
|
|
7080
|
+
<div id="settings-message" class="hidden mb-4 rounded-lg p-4 text-sm"></div>
|
|
7081
|
+
|
|
7082
|
+
<form id="stripe-settings-form" class="rounded-xl bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl ring-1 ring-zinc-950/5 dark:ring-white/10 shadow-sm divide-y divide-zinc-950/5 dark:divide-white/5">
|
|
7083
|
+
<div class="p-6 space-y-5">
|
|
7084
|
+
<div>
|
|
7085
|
+
<label class="block text-sm font-medium text-zinc-950 dark:text-white mb-1.5">Publishable Key</label>
|
|
7086
|
+
<input type="text" name="stripePublishableKey" value="${settings.stripePublishableKey}"
|
|
7087
|
+
placeholder="pk_..."
|
|
7088
|
+
class="w-full rounded-lg border-0 bg-white dark:bg-zinc-800 px-3.5 py-2 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:ring-2 focus:ring-cyan-500" />
|
|
7089
|
+
<p class="mt-1 text-xs text-zinc-500 dark:text-zinc-400">Your Stripe publishable key (starts with pk_)</p>
|
|
7090
|
+
</div>
|
|
7091
|
+
|
|
7092
|
+
<div>
|
|
7093
|
+
<label class="block text-sm font-medium text-zinc-950 dark:text-white mb-1.5">Secret Key</label>
|
|
7094
|
+
<input type="password" name="stripeSecretKey" value="${settings.stripeSecretKey}"
|
|
7095
|
+
placeholder="sk_..."
|
|
7096
|
+
class="w-full rounded-lg border-0 bg-white dark:bg-zinc-800 px-3.5 py-2 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:ring-2 focus:ring-cyan-500" />
|
|
7097
|
+
<p class="mt-1 text-xs text-zinc-500 dark:text-zinc-400">Your Stripe secret API key (starts with sk_)</p>
|
|
7098
|
+
</div>
|
|
7099
|
+
|
|
7100
|
+
<div>
|
|
7101
|
+
<label class="block text-sm font-medium text-zinc-950 dark:text-white mb-1.5">Webhook Signing Secret</label>
|
|
7102
|
+
<input type="password" name="stripeWebhookSecret" value="${settings.stripeWebhookSecret}"
|
|
7103
|
+
placeholder="whsec_..."
|
|
7104
|
+
class="w-full rounded-lg border-0 bg-white dark:bg-zinc-800 px-3.5 py-2 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:ring-2 focus:ring-cyan-500" />
|
|
7105
|
+
<p class="mt-1 text-xs text-zinc-500 dark:text-zinc-400">Stripe webhook endpoint signing secret (starts with whsec_)</p>
|
|
7106
|
+
</div>
|
|
7107
|
+
|
|
7108
|
+
<div>
|
|
7109
|
+
<label class="block text-sm font-medium text-zinc-950 dark:text-white mb-1.5">Default Price ID</label>
|
|
7110
|
+
<input type="text" name="stripePriceId" value="${settings.stripePriceId || ""}"
|
|
7111
|
+
placeholder="price_..."
|
|
7112
|
+
class="w-full rounded-lg border-0 bg-white dark:bg-zinc-800 px-3.5 py-2 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:ring-2 focus:ring-cyan-500" />
|
|
7113
|
+
<p class="mt-1 text-xs text-zinc-500 dark:text-zinc-400">Default Stripe Price ID for checkout sessions (optional)</p>
|
|
7114
|
+
</div>
|
|
7115
|
+
|
|
7116
|
+
<div>
|
|
7117
|
+
<label class="block text-sm font-medium text-zinc-950 dark:text-white mb-1.5">Checkout Success URL</label>
|
|
7118
|
+
<input type="text" name="successUrl" value="${settings.successUrl}"
|
|
7119
|
+
class="w-full rounded-lg border-0 bg-white dark:bg-zinc-800 px-3.5 py-2 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:ring-2 focus:ring-cyan-500" />
|
|
7120
|
+
<p class="mt-1 text-xs text-zinc-500 dark:text-zinc-400">Redirect URL after successful checkout</p>
|
|
7121
|
+
</div>
|
|
7122
|
+
|
|
7123
|
+
<div>
|
|
7124
|
+
<label class="block text-sm font-medium text-zinc-950 dark:text-white mb-1.5">Checkout Cancel URL</label>
|
|
7125
|
+
<input type="text" name="cancelUrl" value="${settings.cancelUrl}"
|
|
7126
|
+
class="w-full rounded-lg border-0 bg-white dark:bg-zinc-800 px-3.5 py-2 text-sm text-zinc-950 dark:text-white ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:ring-2 focus:ring-cyan-500" />
|
|
7127
|
+
<p class="mt-1 text-xs text-zinc-500 dark:text-zinc-400">Redirect URL if checkout is cancelled</p>
|
|
7128
|
+
</div>
|
|
7129
|
+
</div>
|
|
7130
|
+
|
|
7131
|
+
<div class="px-6 py-4 flex justify-end">
|
|
7132
|
+
<button type="submit"
|
|
7133
|
+
class="inline-flex items-center justify-center rounded-lg bg-zinc-950 dark:bg-white px-3.5 py-2.5 text-sm font-semibold text-white dark:text-zinc-950 hover:bg-zinc-800 dark:hover:bg-zinc-100 transition-colors shadow-sm">
|
|
7134
|
+
Save Settings
|
|
7135
|
+
</button>
|
|
7136
|
+
</div>
|
|
7137
|
+
</form>
|
|
7138
|
+
</div>
|
|
7139
|
+
|
|
7140
|
+
<script>
|
|
7141
|
+
document.getElementById('stripe-settings-form').addEventListener('submit', async (e) => {
|
|
7142
|
+
e.preventDefault()
|
|
7143
|
+
const form = e.target
|
|
7144
|
+
const data = Object.fromEntries(new FormData(form))
|
|
7145
|
+
const msg = document.getElementById('settings-message')
|
|
7146
|
+
try {
|
|
7147
|
+
const res = await fetch('/admin/plugins/stripe/settings', {
|
|
7148
|
+
method: 'POST',
|
|
7149
|
+
headers: { 'Content-Type': 'application/json' },
|
|
7150
|
+
body: JSON.stringify(data)
|
|
7151
|
+
})
|
|
7152
|
+
const result = await res.json()
|
|
7153
|
+
msg.className = result.success
|
|
7154
|
+
? 'mb-4 rounded-lg p-4 text-sm bg-emerald-400/10 text-emerald-500 dark:text-emerald-400 ring-1 ring-inset ring-emerald-400/20'
|
|
7155
|
+
: 'mb-4 rounded-lg p-4 text-sm bg-red-400/10 text-red-500 dark:text-red-400 ring-1 ring-inset ring-red-400/20'
|
|
7156
|
+
msg.textContent = result.success ? 'Settings saved successfully.' : (result.error || 'Failed to save settings.')
|
|
7157
|
+
} catch {
|
|
7158
|
+
msg.className = 'mb-4 rounded-lg p-4 text-sm bg-red-400/10 text-red-500 dark:text-red-400 ring-1 ring-inset ring-red-400/20'
|
|
7159
|
+
msg.textContent = 'Network error. Please try again.'
|
|
7160
|
+
}
|
|
7161
|
+
})
|
|
7162
|
+
</script>
|
|
7163
|
+
`;
|
|
7164
|
+
return c.html(renderAdminLayoutCatalyst2({
|
|
7165
|
+
title: "Stripe Settings",
|
|
7166
|
+
pageTitle: "Stripe Settings",
|
|
7167
|
+
currentPath: "/admin/plugins/stripe",
|
|
7168
|
+
user: user ? { name: user.email, email: user.email, role: user.role } : void 0,
|
|
7169
|
+
content: content2,
|
|
7170
|
+
version: c.get("appVersion"),
|
|
7171
|
+
dynamicMenuItems: c.get("pluginMenuItems")
|
|
7172
|
+
}));
|
|
7173
|
+
});
|
|
6647
7174
|
adminRoutes3.post("/settings", async (c) => {
|
|
6648
7175
|
try {
|
|
6649
7176
|
const body = await c.req.json();
|
|
@@ -6733,6 +7260,30 @@ var StripeAPI = class {
|
|
|
6733
7260
|
}
|
|
6734
7261
|
return this.request("POST", "/customers", body);
|
|
6735
7262
|
}
|
|
7263
|
+
/**
|
|
7264
|
+
* List subscriptions with pagination (auto-expands across pages)
|
|
7265
|
+
*/
|
|
7266
|
+
async listSubscriptions(params) {
|
|
7267
|
+
const qs = new URLSearchParams();
|
|
7268
|
+
qs.append("limit", String(params?.limit || 100));
|
|
7269
|
+
if (params?.status) qs.append("status", params.status);
|
|
7270
|
+
if (params?.startingAfter) qs.append("starting_after", params.startingAfter);
|
|
7271
|
+
return this.request("GET", `/subscriptions?${qs.toString()}`);
|
|
7272
|
+
}
|
|
7273
|
+
/**
|
|
7274
|
+
* Fetch ALL subscriptions from Stripe (handles pagination automatically)
|
|
7275
|
+
*/
|
|
7276
|
+
async listAllSubscriptions() {
|
|
7277
|
+
const all = [];
|
|
7278
|
+
let startingAfter;
|
|
7279
|
+
while (true) {
|
|
7280
|
+
const result = await this.listSubscriptions({ limit: 100, startingAfter });
|
|
7281
|
+
all.push(...result.data);
|
|
7282
|
+
if (!result.has_more || result.data.length === 0) break;
|
|
7283
|
+
startingAfter = result.data[result.data.length - 1].id;
|
|
7284
|
+
}
|
|
7285
|
+
return all;
|
|
7286
|
+
}
|
|
6736
7287
|
/**
|
|
6737
7288
|
* Search for a customer by email
|
|
6738
7289
|
*/
|
|
@@ -6771,9 +7322,9 @@ function timingSafeEqual(a, b) {
|
|
|
6771
7322
|
|
|
6772
7323
|
// src/plugins/core-plugins/stripe-plugin/routes/api.ts
|
|
6773
7324
|
var apiRoutes3 = new hono.Hono();
|
|
6774
|
-
async function
|
|
7325
|
+
async function getSettings4(db) {
|
|
6775
7326
|
try {
|
|
6776
|
-
const pluginService = new
|
|
7327
|
+
const pluginService = new chunk43AB4EH4_cjs.PluginService(db);
|
|
6777
7328
|
const plugin2 = await pluginService.getPlugin("stripe");
|
|
6778
7329
|
if (plugin2?.settings) {
|
|
6779
7330
|
const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
|
|
@@ -6798,7 +7349,7 @@ function mapStripeStatus(status) {
|
|
|
6798
7349
|
}
|
|
6799
7350
|
apiRoutes3.post("/webhook", async (c) => {
|
|
6800
7351
|
const db = c.env.DB;
|
|
6801
|
-
const settings = await
|
|
7352
|
+
const settings = await getSettings4(db);
|
|
6802
7353
|
if (!settings.stripeWebhookSecret) {
|
|
6803
7354
|
return c.json({ error: "Webhook secret not configured" }, 500);
|
|
6804
7355
|
}
|
|
@@ -6811,7 +7362,11 @@ apiRoutes3.post("/webhook", async (c) => {
|
|
|
6811
7362
|
}
|
|
6812
7363
|
const event = JSON.parse(rawBody);
|
|
6813
7364
|
const subscriptionService = new SubscriptionService(db);
|
|
6814
|
-
|
|
7365
|
+
const eventService = new StripeEventService(db);
|
|
7366
|
+
await Promise.all([subscriptionService.ensureTable(), eventService.ensureTable()]);
|
|
7367
|
+
const obj = event.data.object;
|
|
7368
|
+
const objectId = obj?.id || "";
|
|
7369
|
+
const objectType = obj?.object || event.type.split(".")[0] || "";
|
|
6815
7370
|
try {
|
|
6816
7371
|
switch (event.type) {
|
|
6817
7372
|
case "customer.subscription.created": {
|
|
@@ -6886,18 +7441,45 @@ apiRoutes3.post("/webhook", async (c) => {
|
|
|
6886
7441
|
}
|
|
6887
7442
|
default:
|
|
6888
7443
|
console.log(`[Stripe] Unhandled event type: ${event.type}`);
|
|
6889
|
-
|
|
7444
|
+
await eventService.log({
|
|
7445
|
+
stripeEventId: event.id,
|
|
7446
|
+
type: event.type,
|
|
7447
|
+
objectId,
|
|
7448
|
+
objectType,
|
|
7449
|
+
data: event.data.object,
|
|
7450
|
+
status: "ignored"
|
|
7451
|
+
});
|
|
7452
|
+
return c.json({ received: true });
|
|
7453
|
+
}
|
|
7454
|
+
await eventService.log({
|
|
7455
|
+
stripeEventId: event.id,
|
|
7456
|
+
type: event.type,
|
|
7457
|
+
objectId,
|
|
7458
|
+
objectType,
|
|
7459
|
+
data: event.data.object,
|
|
7460
|
+
status: "processed"
|
|
7461
|
+
});
|
|
6890
7462
|
} catch (error) {
|
|
7463
|
+
await eventService.log({
|
|
7464
|
+
stripeEventId: event.id,
|
|
7465
|
+
type: event.type,
|
|
7466
|
+
objectId,
|
|
7467
|
+
objectType,
|
|
7468
|
+
data: event.data.object,
|
|
7469
|
+
status: "failed",
|
|
7470
|
+
error: error instanceof Error ? error.message : String(error)
|
|
7471
|
+
}).catch(() => {
|
|
7472
|
+
});
|
|
6891
7473
|
console.error(`[Stripe] Error processing webhook event ${event.type}:`, error);
|
|
6892
7474
|
return c.json({ error: "Webhook processing failed" }, 500);
|
|
6893
7475
|
}
|
|
6894
7476
|
return c.json({ received: true });
|
|
6895
7477
|
});
|
|
6896
|
-
apiRoutes3.post("/create-checkout-session",
|
|
7478
|
+
apiRoutes3.post("/create-checkout-session", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
6897
7479
|
const db = c.env.DB;
|
|
6898
7480
|
const user = c.get("user");
|
|
6899
7481
|
if (!user) return c.json({ error: "Unauthorized" }, 401);
|
|
6900
|
-
const settings = await
|
|
7482
|
+
const settings = await getSettings4(db);
|
|
6901
7483
|
if (!settings.stripeSecretKey) {
|
|
6902
7484
|
return c.json({ error: "Stripe not configured" }, 500);
|
|
6903
7485
|
}
|
|
@@ -6933,7 +7515,7 @@ apiRoutes3.post("/create-checkout-session", chunkYYMPHM3I_cjs.requireAuth(), asy
|
|
|
6933
7515
|
});
|
|
6934
7516
|
return c.json({ sessionId: session.id, url: session.url });
|
|
6935
7517
|
});
|
|
6936
|
-
apiRoutes3.get("/subscription",
|
|
7518
|
+
apiRoutes3.get("/subscription", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
6937
7519
|
const user = c.get("user");
|
|
6938
7520
|
if (!user) return c.json({ error: "Unauthorized" }, 401);
|
|
6939
7521
|
const db = c.env.DB;
|
|
@@ -6945,7 +7527,7 @@ apiRoutes3.get("/subscription", chunkYYMPHM3I_cjs.requireAuth(), async (c) => {
|
|
|
6945
7527
|
}
|
|
6946
7528
|
return c.json({ subscription });
|
|
6947
7529
|
});
|
|
6948
|
-
apiRoutes3.get("/subscriptions",
|
|
7530
|
+
apiRoutes3.get("/subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
6949
7531
|
const user = c.get("user");
|
|
6950
7532
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
6951
7533
|
const db = c.env.DB;
|
|
@@ -6961,7 +7543,7 @@ apiRoutes3.get("/subscriptions", chunkYYMPHM3I_cjs.requireAuth(), async (c) => {
|
|
|
6961
7543
|
const result = await subscriptionService.list(filters);
|
|
6962
7544
|
return c.json(result);
|
|
6963
7545
|
});
|
|
6964
|
-
apiRoutes3.get("/stats",
|
|
7546
|
+
apiRoutes3.get("/stats", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
6965
7547
|
const user = c.get("user");
|
|
6966
7548
|
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
6967
7549
|
const db = c.env.DB;
|
|
@@ -6970,10 +7552,78 @@ apiRoutes3.get("/stats", chunkYYMPHM3I_cjs.requireAuth(), async (c) => {
|
|
|
6970
7552
|
const stats = await subscriptionService.getStats();
|
|
6971
7553
|
return c.json(stats);
|
|
6972
7554
|
});
|
|
7555
|
+
apiRoutes3.post("/sync-subscriptions", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
7556
|
+
const user = c.get("user");
|
|
7557
|
+
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
7558
|
+
const db = c.env.DB;
|
|
7559
|
+
const settings = await getSettings4(db);
|
|
7560
|
+
if (!settings.stripeSecretKey) {
|
|
7561
|
+
return c.json({ error: "Stripe secret key not configured" }, 400);
|
|
7562
|
+
}
|
|
7563
|
+
const stripeApi = new StripeAPI(settings.stripeSecretKey);
|
|
7564
|
+
const subscriptionService = new SubscriptionService(db);
|
|
7565
|
+
await subscriptionService.ensureTable();
|
|
7566
|
+
try {
|
|
7567
|
+
const allSubs = await stripeApi.listAllSubscriptions();
|
|
7568
|
+
let synced = 0;
|
|
7569
|
+
let errors = 0;
|
|
7570
|
+
for (const sub of allSubs) {
|
|
7571
|
+
try {
|
|
7572
|
+
const userId = sub.metadata?.sonicjs_user_id || await subscriptionService.getUserIdByStripeCustomer(sub.customer) || "";
|
|
7573
|
+
await subscriptionService.upsert({
|
|
7574
|
+
userId,
|
|
7575
|
+
stripeCustomerId: typeof sub.customer === "string" ? sub.customer : sub.customer.id,
|
|
7576
|
+
stripeSubscriptionId: sub.id,
|
|
7577
|
+
stripePriceId: sub.items?.data?.[0]?.price?.id || "",
|
|
7578
|
+
status: mapStripeStatus(sub.status),
|
|
7579
|
+
currentPeriodStart: sub.current_period_start,
|
|
7580
|
+
currentPeriodEnd: sub.current_period_end,
|
|
7581
|
+
cancelAtPeriodEnd: sub.cancel_at_period_end
|
|
7582
|
+
});
|
|
7583
|
+
synced++;
|
|
7584
|
+
} catch (err) {
|
|
7585
|
+
console.error(`[Stripe Sync] Failed to upsert subscription ${sub.id}:`, err);
|
|
7586
|
+
errors++;
|
|
7587
|
+
}
|
|
7588
|
+
}
|
|
7589
|
+
return c.json({
|
|
7590
|
+
success: true,
|
|
7591
|
+
total: allSubs.length,
|
|
7592
|
+
synced,
|
|
7593
|
+
errors
|
|
7594
|
+
});
|
|
7595
|
+
} catch (error) {
|
|
7596
|
+
console.error("[Stripe Sync] Error:", error);
|
|
7597
|
+
return c.json({
|
|
7598
|
+
success: false,
|
|
7599
|
+
error: error instanceof Error ? error.message : "Sync failed"
|
|
7600
|
+
}, 500);
|
|
7601
|
+
}
|
|
7602
|
+
});
|
|
7603
|
+
apiRoutes3.get("/events", chunkUFPT5KCQ_cjs.requireAuth(), async (c) => {
|
|
7604
|
+
const user = c.get("user");
|
|
7605
|
+
if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
|
|
7606
|
+
const db = c.env.DB;
|
|
7607
|
+
const eventService = new StripeEventService(db);
|
|
7608
|
+
await eventService.ensureTable();
|
|
7609
|
+
const filters = {
|
|
7610
|
+
type: c.req.query("type") || void 0,
|
|
7611
|
+
status: c.req.query("status") || void 0,
|
|
7612
|
+
objectId: c.req.query("objectId") || void 0,
|
|
7613
|
+
page: c.req.query("page") ? parseInt(c.req.query("page")) : 1,
|
|
7614
|
+
limit: c.req.query("limit") ? parseInt(c.req.query("limit")) : 50
|
|
7615
|
+
};
|
|
7616
|
+
const [result, stats, types] = await Promise.all([
|
|
7617
|
+
eventService.list(filters),
|
|
7618
|
+
eventService.getStats(),
|
|
7619
|
+
eventService.getDistinctTypes()
|
|
7620
|
+
]);
|
|
7621
|
+
return c.json({ ...result, stats, types });
|
|
7622
|
+
});
|
|
6973
7623
|
|
|
6974
7624
|
// src/plugins/core-plugins/stripe-plugin/index.ts
|
|
6975
7625
|
function createStripePlugin() {
|
|
6976
|
-
const builder =
|
|
7626
|
+
const builder = chunk635JAMSE_cjs.PluginBuilder.create({
|
|
6977
7627
|
name: "stripe",
|
|
6978
7628
|
version: "1.0.0-beta.1",
|
|
6979
7629
|
description: "Stripe subscription management with webhook handling, checkout sessions, and subscription gating"
|
|
@@ -7016,13 +7666,35 @@ function createStripePlugin() {
|
|
|
7016
7666
|
var stripePlugin = createStripePlugin();
|
|
7017
7667
|
|
|
7018
7668
|
// src/middleware/plugin-menu.ts
|
|
7019
|
-
var
|
|
7020
|
-
|
|
7021
|
-
|
|
7669
|
+
var REGISTRY_MENU_PLUGINS = Object.values(chunk43AB4EH4_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
|
|
7670
|
+
codeName: p.codeName,
|
|
7671
|
+
label: p.adminMenu.label,
|
|
7672
|
+
path: p.adminMenu.path,
|
|
7673
|
+
icon: p.adminMenu.icon,
|
|
7674
|
+
order: p.adminMenu.order
|
|
7675
|
+
}));
|
|
7676
|
+
var ICON_SVG = {
|
|
7677
|
+
"magnifying-glass": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/></svg>',
|
|
7678
|
+
"chart-bar": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"/></svg>',
|
|
7679
|
+
"image": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m2.25 15.75 5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5 1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5Zm10.5-11.25h.008v.008h-.008V8.25Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"/></svg>',
|
|
7680
|
+
"palette": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.098 19.902a3.75 3.75 0 0 0 5.304 0l6.401-6.402M6.75 21A3.75 3.75 0 0 1 3 17.25V4.125C3 3.504 3.504 3 4.125 3h5.25c.621 0 1.125.504 1.125 1.125v4.072M6.75 21a3.75 3.75 0 0 0 3.75-3.75V8.197M6.75 21h13.125c.621 0 1.125-.504 1.125-1.125v-5.25c0-.621-.504-1.125-1.125-1.125h-4.072M10.5 8.197l2.88-2.88c.438-.439 1.15-.439 1.59 0l3.712 3.713c.44.44.44 1.152 0 1.59l-2.879 2.88M6.75 17.25h.008v.008H6.75v-.008Z"/></svg>',
|
|
7681
|
+
"envelope": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75"/></svg>',
|
|
7682
|
+
"hand-raised": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.05 4.575a1.575 1.575 0 1 0-3.15 0v3m3.15-3v-1.5a1.575 1.575 0 0 1 3.15 0v1.5m-3.15 0 .075 5.925m3.075-5.925v2.925m0-2.925a1.575 1.575 0 0 1 3.15 0V9.9m-3.15-2.4v5.325M16.5 9.9a1.575 1.575 0 0 1 3.15 0V15a6.15 6.15 0 0 1-6.15 6.15H12A6.15 6.15 0 0 1 5.85 15V9.525"/></svg>',
|
|
7683
|
+
"key": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"/></svg>',
|
|
7684
|
+
"arrow-right": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"/></svg>',
|
|
7685
|
+
"shield-check": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/></svg>',
|
|
7686
|
+
"credit-card": '<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z"/></svg>'
|
|
7687
|
+
};
|
|
7688
|
+
function resolveIcon(iconName) {
|
|
7689
|
+
if (!iconName) return "";
|
|
7690
|
+
if (iconName.startsWith("<svg") || iconName.startsWith("<")) return iconName;
|
|
7691
|
+
return ICON_SVG[iconName] || "";
|
|
7692
|
+
}
|
|
7022
7693
|
var MARKER = "<!-- DYNAMIC_PLUGIN_MENU -->";
|
|
7023
7694
|
function renderMenuItem(item, currentPath) {
|
|
7024
7695
|
const isActive = currentPath === item.path || currentPath.startsWith(item.path);
|
|
7025
7696
|
const fallbackIcon = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>`;
|
|
7697
|
+
const resolvedIcon = resolveIcon(item.icon) || fallbackIcon;
|
|
7026
7698
|
return `
|
|
7027
7699
|
<span class="relative">
|
|
7028
7700
|
${isActive ? '<span class="absolute inset-y-2 -left-4 w-0.5 rounded-full bg-cyan-500 dark:bg-cyan-400"></span>' : ""}
|
|
@@ -7032,7 +7704,7 @@ function renderMenuItem(item, currentPath) {
|
|
|
7032
7704
|
${isActive ? 'data-current="true"' : ""}
|
|
7033
7705
|
>
|
|
7034
7706
|
<span class="shrink-0 ${isActive ? "fill-zinc-950 dark:fill-white" : "fill-zinc-500 dark:fill-zinc-400"}">
|
|
7035
|
-
${
|
|
7707
|
+
${resolvedIcon}
|
|
7036
7708
|
</span>
|
|
7037
7709
|
<span class="truncate">${item.label}</span>
|
|
7038
7710
|
</a>
|
|
@@ -7047,23 +7719,28 @@ function pluginMenuMiddleware() {
|
|
|
7047
7719
|
let activeMenuItems = [];
|
|
7048
7720
|
try {
|
|
7049
7721
|
const db = c.env.DB;
|
|
7050
|
-
const
|
|
7051
|
-
if (
|
|
7052
|
-
const placeholders =
|
|
7722
|
+
const pluginCodeNames = REGISTRY_MENU_PLUGINS.map((p) => p.codeName);
|
|
7723
|
+
if (pluginCodeNames.length > 0) {
|
|
7724
|
+
const placeholders = pluginCodeNames.map(() => "?").join(",");
|
|
7053
7725
|
const result = await db.prepare(
|
|
7054
7726
|
`SELECT name FROM plugins WHERE name IN (${placeholders}) AND status = 'active'`
|
|
7055
|
-
).bind(...
|
|
7727
|
+
).bind(...pluginCodeNames).all();
|
|
7056
7728
|
const activeNames = new Set((result.results || []).map((r) => r.name));
|
|
7057
|
-
for (const plugin2 of
|
|
7058
|
-
if (activeNames.has(plugin2.
|
|
7059
|
-
activeMenuItems.push(
|
|
7729
|
+
for (const plugin2 of REGISTRY_MENU_PLUGINS) {
|
|
7730
|
+
if (activeNames.has(plugin2.codeName)) {
|
|
7731
|
+
activeMenuItems.push({
|
|
7732
|
+
label: plugin2.label,
|
|
7733
|
+
path: plugin2.path,
|
|
7734
|
+
icon: plugin2.icon,
|
|
7735
|
+
order: plugin2.order
|
|
7736
|
+
});
|
|
7060
7737
|
}
|
|
7061
7738
|
}
|
|
7062
|
-
activeMenuItems.sort((a, b) =>
|
|
7739
|
+
activeMenuItems.sort((a, b) => a.order - b.order);
|
|
7063
7740
|
}
|
|
7064
7741
|
} catch {
|
|
7065
7742
|
}
|
|
7066
|
-
c.set("pluginMenuItems", activeMenuItems.map((m) => ({ label: m.label, path: m.path, icon: m.icon || "" })));
|
|
7743
|
+
c.set("pluginMenuItems", activeMenuItems.map((m) => ({ label: m.label, path: m.path, icon: resolveIcon(m.icon) || "" })));
|
|
7067
7744
|
await next();
|
|
7068
7745
|
if (activeMenuItems.length > 0 && c.res.headers.get("content-type")?.includes("text/html")) {
|
|
7069
7746
|
const status = c.res.status;
|
|
@@ -8042,7 +8719,7 @@ async function warmNamespace(namespace, entries) {
|
|
|
8042
8719
|
}
|
|
8043
8720
|
|
|
8044
8721
|
// src/templates/pages/admin-cache.template.ts
|
|
8045
|
-
|
|
8722
|
+
chunkUYJ6TJHX_cjs.init_admin_layout_catalyst_template();
|
|
8046
8723
|
function renderCacheDashboard(data) {
|
|
8047
8724
|
const pageContent = `
|
|
8048
8725
|
<div class="space-y-6">
|
|
@@ -8221,7 +8898,7 @@ function renderCacheDashboard(data) {
|
|
|
8221
8898
|
</script>
|
|
8222
8899
|
|
|
8223
8900
|
<!-- Confirmation Dialogs -->
|
|
8224
|
-
${
|
|
8901
|
+
${chunk26HYU7MX_cjs.renderConfirmationDialog({
|
|
8225
8902
|
id: "clear-all-cache-confirm",
|
|
8226
8903
|
title: "Clear All Cache",
|
|
8227
8904
|
message: "Are you sure you want to clear all cache entries? This cannot be undone.",
|
|
@@ -8232,7 +8909,7 @@ function renderCacheDashboard(data) {
|
|
|
8232
8909
|
onConfirm: "performClearAllCaches()"
|
|
8233
8910
|
})}
|
|
8234
8911
|
|
|
8235
|
-
${
|
|
8912
|
+
${chunk26HYU7MX_cjs.renderConfirmationDialog({
|
|
8236
8913
|
id: "clear-namespace-cache-confirm",
|
|
8237
8914
|
title: "Clear Namespace Cache",
|
|
8238
8915
|
message: "Clear cache for this namespace?",
|
|
@@ -8243,7 +8920,7 @@ function renderCacheDashboard(data) {
|
|
|
8243
8920
|
onConfirm: "performClearNamespaceCache()"
|
|
8244
8921
|
})}
|
|
8245
8922
|
|
|
8246
|
-
${
|
|
8923
|
+
${chunk26HYU7MX_cjs.getConfirmationDialogScript()}
|
|
8247
8924
|
`;
|
|
8248
8925
|
const layoutData = {
|
|
8249
8926
|
title: "Cache System",
|
|
@@ -8253,7 +8930,7 @@ function renderCacheDashboard(data) {
|
|
|
8253
8930
|
version: data.version,
|
|
8254
8931
|
content: pageContent
|
|
8255
8932
|
};
|
|
8256
|
-
return
|
|
8933
|
+
return chunkUYJ6TJHX_cjs.renderAdminLayoutCatalyst(layoutData);
|
|
8257
8934
|
}
|
|
8258
8935
|
function renderStatCard(label, value, color, icon, colorOverride) {
|
|
8259
8936
|
const finalColor = colorOverride || color;
|
|
@@ -8929,14 +9606,14 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
|
8929
9606
|
// src/app.ts
|
|
8930
9607
|
function createSonicJSApp(config = {}) {
|
|
8931
9608
|
const app2 = new hono.Hono();
|
|
8932
|
-
const appVersion = config.version ||
|
|
9609
|
+
const appVersion = config.version || chunkVUISYUHY_cjs.getCoreVersion();
|
|
8933
9610
|
const appName = config.name || "SonicJS AI";
|
|
8934
9611
|
app2.use("*", async (c, next) => {
|
|
8935
9612
|
c.set("appVersion", appVersion);
|
|
8936
9613
|
await next();
|
|
8937
9614
|
});
|
|
8938
|
-
app2.use("*",
|
|
8939
|
-
app2.use("*",
|
|
9615
|
+
app2.use("*", chunkUFPT5KCQ_cjs.metricsMiddleware());
|
|
9616
|
+
app2.use("*", chunkUFPT5KCQ_cjs.bootstrapMiddleware(config));
|
|
8940
9617
|
if (config.middleware?.beforeAuth) {
|
|
8941
9618
|
for (const middleware of config.middleware.beforeAuth) {
|
|
8942
9619
|
app2.use("*", middleware);
|
|
@@ -8945,29 +9622,29 @@ function createSonicJSApp(config = {}) {
|
|
|
8945
9622
|
app2.use("*", async (_c, next) => {
|
|
8946
9623
|
await next();
|
|
8947
9624
|
});
|
|
8948
|
-
app2.use("*",
|
|
8949
|
-
app2.use("*",
|
|
9625
|
+
app2.use("*", chunkUFPT5KCQ_cjs.securityHeadersMiddleware());
|
|
9626
|
+
app2.use("*", chunkUFPT5KCQ_cjs.csrfProtection());
|
|
8950
9627
|
if (config.middleware?.afterAuth) {
|
|
8951
9628
|
for (const middleware of config.middleware.afterAuth) {
|
|
8952
9629
|
app2.use("*", middleware);
|
|
8953
9630
|
}
|
|
8954
9631
|
}
|
|
8955
9632
|
app2.use("/admin/*", pluginMenuMiddleware());
|
|
8956
|
-
app2.route("/api",
|
|
8957
|
-
app2.route("/api/media",
|
|
8958
|
-
app2.route("/api/system",
|
|
8959
|
-
app2.route("/admin/api",
|
|
8960
|
-
app2.route("/admin/dashboard",
|
|
8961
|
-
app2.route("/admin/collections",
|
|
8962
|
-
app2.route("/admin/forms",
|
|
8963
|
-
app2.route("/admin/settings",
|
|
8964
|
-
app2.route("/forms",
|
|
8965
|
-
app2.route("/api/forms",
|
|
8966
|
-
app2.route("/admin/api-reference",
|
|
9633
|
+
app2.route("/api", chunk26HYU7MX_cjs.api_default);
|
|
9634
|
+
app2.route("/api/media", chunk26HYU7MX_cjs.api_media_default);
|
|
9635
|
+
app2.route("/api/system", chunk26HYU7MX_cjs.api_system_default);
|
|
9636
|
+
app2.route("/admin/api", chunk26HYU7MX_cjs.admin_api_default);
|
|
9637
|
+
app2.route("/admin/dashboard", chunk26HYU7MX_cjs.router);
|
|
9638
|
+
app2.route("/admin/collections", chunk26HYU7MX_cjs.adminCollectionsRoutes);
|
|
9639
|
+
app2.route("/admin/forms", chunk26HYU7MX_cjs.adminFormsRoutes);
|
|
9640
|
+
app2.route("/admin/settings", chunk26HYU7MX_cjs.adminSettingsRoutes);
|
|
9641
|
+
app2.route("/forms", chunk26HYU7MX_cjs.public_forms_default);
|
|
9642
|
+
app2.route("/api/forms", chunk26HYU7MX_cjs.public_forms_default);
|
|
9643
|
+
app2.route("/admin/api-reference", chunk26HYU7MX_cjs.router2);
|
|
8967
9644
|
app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
|
|
8968
9645
|
app2.route("/admin/seed-data", createSeedDataAdminRoutes());
|
|
8969
|
-
app2.route("/admin/content",
|
|
8970
|
-
app2.route("/admin/media",
|
|
9646
|
+
app2.route("/admin/content", chunk26HYU7MX_cjs.admin_content_default);
|
|
9647
|
+
app2.route("/admin/media", chunk26HYU7MX_cjs.adminMediaRoutes);
|
|
8971
9648
|
app2.use("/auth/*", securityAuditMiddleware());
|
|
8972
9649
|
if (securityAuditPlugin.routes && securityAuditPlugin.routes.length > 0) {
|
|
8973
9650
|
for (const route of securityAuditPlugin.routes) {
|
|
@@ -8985,8 +9662,8 @@ function createSonicJSApp(config = {}) {
|
|
|
8985
9662
|
app2.route(route.path, route.handler);
|
|
8986
9663
|
}
|
|
8987
9664
|
}
|
|
8988
|
-
if (
|
|
8989
|
-
for (const route of
|
|
9665
|
+
if (chunk26HYU7MX_cjs.userProfilesPlugin.routes && chunk26HYU7MX_cjs.userProfilesPlugin.routes.length > 0) {
|
|
9666
|
+
for (const route of chunk26HYU7MX_cjs.userProfilesPlugin.routes) {
|
|
8990
9667
|
app2.route(route.path, route.handler);
|
|
8991
9668
|
}
|
|
8992
9669
|
}
|
|
@@ -8995,16 +9672,16 @@ function createSonicJSApp(config = {}) {
|
|
|
8995
9672
|
app2.route(route.path, route.handler);
|
|
8996
9673
|
}
|
|
8997
9674
|
}
|
|
8998
|
-
app2.route("/admin/plugins", chunkDRWSHIFG_cjs.adminPluginRoutes);
|
|
8999
|
-
app2.route("/admin/logs", chunkDRWSHIFG_cjs.adminLogsRoutes);
|
|
9000
|
-
app2.route("/admin", chunkDRWSHIFG_cjs.userRoutes);
|
|
9001
|
-
app2.route("/auth", chunkDRWSHIFG_cjs.auth_default);
|
|
9002
|
-
app2.route("/", chunkDRWSHIFG_cjs.test_cleanup_default);
|
|
9003
9675
|
if (stripePlugin.routes && stripePlugin.routes.length > 0) {
|
|
9004
9676
|
for (const route of stripePlugin.routes) {
|
|
9005
9677
|
app2.route(route.path, route.handler);
|
|
9006
9678
|
}
|
|
9007
9679
|
}
|
|
9680
|
+
app2.route("/admin/plugins", chunk26HYU7MX_cjs.adminPluginRoutes);
|
|
9681
|
+
app2.route("/admin/logs", chunk26HYU7MX_cjs.adminLogsRoutes);
|
|
9682
|
+
app2.route("/admin", chunk26HYU7MX_cjs.userRoutes);
|
|
9683
|
+
app2.route("/auth", chunk26HYU7MX_cjs.auth_default);
|
|
9684
|
+
app2.route("/", chunk26HYU7MX_cjs.test_cleanup_default);
|
|
9008
9685
|
if (emailPlugin.routes && emailPlugin.routes.length > 0) {
|
|
9009
9686
|
for (const route of emailPlugin.routes) {
|
|
9010
9687
|
app2.route(route.path, route.handler);
|
|
@@ -9088,99 +9765,99 @@ function createDb(d1$1) {
|
|
|
9088
9765
|
}
|
|
9089
9766
|
|
|
9090
9767
|
// src/index.ts
|
|
9091
|
-
var VERSION =
|
|
9768
|
+
var VERSION = chunkVUISYUHY_cjs.package_default.version;
|
|
9092
9769
|
|
|
9093
9770
|
Object.defineProperty(exports, "ROUTES_INFO", {
|
|
9094
9771
|
enumerable: true,
|
|
9095
|
-
get: function () { return
|
|
9772
|
+
get: function () { return chunk26HYU7MX_cjs.ROUTES_INFO; }
|
|
9096
9773
|
});
|
|
9097
9774
|
Object.defineProperty(exports, "adminApiRoutes", {
|
|
9098
9775
|
enumerable: true,
|
|
9099
|
-
get: function () { return
|
|
9776
|
+
get: function () { return chunk26HYU7MX_cjs.admin_api_default; }
|
|
9100
9777
|
});
|
|
9101
9778
|
Object.defineProperty(exports, "adminCheckboxRoutes", {
|
|
9102
9779
|
enumerable: true,
|
|
9103
|
-
get: function () { return
|
|
9780
|
+
get: function () { return chunk26HYU7MX_cjs.adminCheckboxRoutes; }
|
|
9104
9781
|
});
|
|
9105
9782
|
Object.defineProperty(exports, "adminCodeExamplesRoutes", {
|
|
9106
9783
|
enumerable: true,
|
|
9107
|
-
get: function () { return
|
|
9784
|
+
get: function () { return chunk26HYU7MX_cjs.admin_code_examples_default; }
|
|
9108
9785
|
});
|
|
9109
9786
|
Object.defineProperty(exports, "adminCollectionsRoutes", {
|
|
9110
9787
|
enumerable: true,
|
|
9111
|
-
get: function () { return
|
|
9788
|
+
get: function () { return chunk26HYU7MX_cjs.adminCollectionsRoutes; }
|
|
9112
9789
|
});
|
|
9113
9790
|
Object.defineProperty(exports, "adminContentRoutes", {
|
|
9114
9791
|
enumerable: true,
|
|
9115
|
-
get: function () { return
|
|
9792
|
+
get: function () { return chunk26HYU7MX_cjs.admin_content_default; }
|
|
9116
9793
|
});
|
|
9117
9794
|
Object.defineProperty(exports, "adminDashboardRoutes", {
|
|
9118
9795
|
enumerable: true,
|
|
9119
|
-
get: function () { return
|
|
9796
|
+
get: function () { return chunk26HYU7MX_cjs.router; }
|
|
9120
9797
|
});
|
|
9121
9798
|
Object.defineProperty(exports, "adminDesignRoutes", {
|
|
9122
9799
|
enumerable: true,
|
|
9123
|
-
get: function () { return
|
|
9800
|
+
get: function () { return chunk26HYU7MX_cjs.adminDesignRoutes; }
|
|
9124
9801
|
});
|
|
9125
9802
|
Object.defineProperty(exports, "adminLogsRoutes", {
|
|
9126
9803
|
enumerable: true,
|
|
9127
|
-
get: function () { return
|
|
9804
|
+
get: function () { return chunk26HYU7MX_cjs.adminLogsRoutes; }
|
|
9128
9805
|
});
|
|
9129
9806
|
Object.defineProperty(exports, "adminMediaRoutes", {
|
|
9130
9807
|
enumerable: true,
|
|
9131
|
-
get: function () { return
|
|
9808
|
+
get: function () { return chunk26HYU7MX_cjs.adminMediaRoutes; }
|
|
9132
9809
|
});
|
|
9133
9810
|
Object.defineProperty(exports, "adminPluginRoutes", {
|
|
9134
9811
|
enumerable: true,
|
|
9135
|
-
get: function () { return
|
|
9812
|
+
get: function () { return chunk26HYU7MX_cjs.adminPluginRoutes; }
|
|
9136
9813
|
});
|
|
9137
9814
|
Object.defineProperty(exports, "adminSettingsRoutes", {
|
|
9138
9815
|
enumerable: true,
|
|
9139
|
-
get: function () { return
|
|
9816
|
+
get: function () { return chunk26HYU7MX_cjs.adminSettingsRoutes; }
|
|
9140
9817
|
});
|
|
9141
9818
|
Object.defineProperty(exports, "adminTestimonialsRoutes", {
|
|
9142
9819
|
enumerable: true,
|
|
9143
|
-
get: function () { return
|
|
9820
|
+
get: function () { return chunk26HYU7MX_cjs.admin_testimonials_default; }
|
|
9144
9821
|
});
|
|
9145
9822
|
Object.defineProperty(exports, "adminUsersRoutes", {
|
|
9146
9823
|
enumerable: true,
|
|
9147
|
-
get: function () { return
|
|
9824
|
+
get: function () { return chunk26HYU7MX_cjs.userRoutes; }
|
|
9148
9825
|
});
|
|
9149
9826
|
Object.defineProperty(exports, "apiContentCrudRoutes", {
|
|
9150
9827
|
enumerable: true,
|
|
9151
|
-
get: function () { return
|
|
9828
|
+
get: function () { return chunk26HYU7MX_cjs.api_content_crud_default; }
|
|
9152
9829
|
});
|
|
9153
9830
|
Object.defineProperty(exports, "apiMediaRoutes", {
|
|
9154
9831
|
enumerable: true,
|
|
9155
|
-
get: function () { return
|
|
9832
|
+
get: function () { return chunk26HYU7MX_cjs.api_media_default; }
|
|
9156
9833
|
});
|
|
9157
9834
|
Object.defineProperty(exports, "apiRoutes", {
|
|
9158
9835
|
enumerable: true,
|
|
9159
|
-
get: function () { return
|
|
9836
|
+
get: function () { return chunk26HYU7MX_cjs.api_default; }
|
|
9160
9837
|
});
|
|
9161
9838
|
Object.defineProperty(exports, "apiSystemRoutes", {
|
|
9162
9839
|
enumerable: true,
|
|
9163
|
-
get: function () { return
|
|
9840
|
+
get: function () { return chunk26HYU7MX_cjs.api_system_default; }
|
|
9164
9841
|
});
|
|
9165
9842
|
Object.defineProperty(exports, "authRoutes", {
|
|
9166
9843
|
enumerable: true,
|
|
9167
|
-
get: function () { return
|
|
9844
|
+
get: function () { return chunk26HYU7MX_cjs.auth_default; }
|
|
9168
9845
|
});
|
|
9169
9846
|
Object.defineProperty(exports, "createUserProfilesPlugin", {
|
|
9170
9847
|
enumerable: true,
|
|
9171
|
-
get: function () { return
|
|
9848
|
+
get: function () { return chunk26HYU7MX_cjs.createUserProfilesPlugin; }
|
|
9172
9849
|
});
|
|
9173
9850
|
Object.defineProperty(exports, "defineUserProfile", {
|
|
9174
9851
|
enumerable: true,
|
|
9175
|
-
get: function () { return
|
|
9852
|
+
get: function () { return chunk26HYU7MX_cjs.defineUserProfile; }
|
|
9176
9853
|
});
|
|
9177
9854
|
Object.defineProperty(exports, "getUserProfileConfig", {
|
|
9178
9855
|
enumerable: true,
|
|
9179
|
-
get: function () { return
|
|
9856
|
+
get: function () { return chunk26HYU7MX_cjs.getUserProfileConfig; }
|
|
9180
9857
|
});
|
|
9181
9858
|
Object.defineProperty(exports, "userProfilesPlugin", {
|
|
9182
9859
|
enumerable: true,
|
|
9183
|
-
get: function () { return
|
|
9860
|
+
get: function () { return chunk26HYU7MX_cjs.userProfilesPlugin; }
|
|
9184
9861
|
});
|
|
9185
9862
|
Object.defineProperty(exports, "Logger", {
|
|
9186
9863
|
enumerable: true,
|
|
@@ -9348,259 +10025,259 @@ Object.defineProperty(exports, "workflowHistory", {
|
|
|
9348
10025
|
});
|
|
9349
10026
|
Object.defineProperty(exports, "AuthManager", {
|
|
9350
10027
|
enumerable: true,
|
|
9351
|
-
get: function () { return
|
|
10028
|
+
get: function () { return chunkUFPT5KCQ_cjs.AuthManager; }
|
|
9352
10029
|
});
|
|
9353
10030
|
Object.defineProperty(exports, "PermissionManager", {
|
|
9354
10031
|
enumerable: true,
|
|
9355
|
-
get: function () { return
|
|
10032
|
+
get: function () { return chunkUFPT5KCQ_cjs.PermissionManager; }
|
|
9356
10033
|
});
|
|
9357
10034
|
Object.defineProperty(exports, "bootstrapMiddleware", {
|
|
9358
10035
|
enumerable: true,
|
|
9359
|
-
get: function () { return
|
|
10036
|
+
get: function () { return chunkUFPT5KCQ_cjs.bootstrapMiddleware; }
|
|
9360
10037
|
});
|
|
9361
10038
|
Object.defineProperty(exports, "cacheHeaders", {
|
|
9362
10039
|
enumerable: true,
|
|
9363
|
-
get: function () { return
|
|
10040
|
+
get: function () { return chunkUFPT5KCQ_cjs.cacheHeaders; }
|
|
9364
10041
|
});
|
|
9365
10042
|
Object.defineProperty(exports, "compressionMiddleware", {
|
|
9366
10043
|
enumerable: true,
|
|
9367
|
-
get: function () { return
|
|
10044
|
+
get: function () { return chunkUFPT5KCQ_cjs.compressionMiddleware; }
|
|
9368
10045
|
});
|
|
9369
10046
|
Object.defineProperty(exports, "detailedLoggingMiddleware", {
|
|
9370
10047
|
enumerable: true,
|
|
9371
|
-
get: function () { return
|
|
10048
|
+
get: function () { return chunkUFPT5KCQ_cjs.detailedLoggingMiddleware; }
|
|
9372
10049
|
});
|
|
9373
10050
|
Object.defineProperty(exports, "getActivePlugins", {
|
|
9374
10051
|
enumerable: true,
|
|
9375
|
-
get: function () { return
|
|
10052
|
+
get: function () { return chunkUFPT5KCQ_cjs.getActivePlugins; }
|
|
9376
10053
|
});
|
|
9377
10054
|
Object.defineProperty(exports, "isPluginActive", {
|
|
9378
10055
|
enumerable: true,
|
|
9379
|
-
get: function () { return
|
|
10056
|
+
get: function () { return chunkUFPT5KCQ_cjs.isPluginActive; }
|
|
9380
10057
|
});
|
|
9381
10058
|
Object.defineProperty(exports, "logActivity", {
|
|
9382
10059
|
enumerable: true,
|
|
9383
|
-
get: function () { return
|
|
10060
|
+
get: function () { return chunkUFPT5KCQ_cjs.logActivity; }
|
|
9384
10061
|
});
|
|
9385
10062
|
Object.defineProperty(exports, "loggingMiddleware", {
|
|
9386
10063
|
enumerable: true,
|
|
9387
|
-
get: function () { return
|
|
10064
|
+
get: function () { return chunkUFPT5KCQ_cjs.loggingMiddleware; }
|
|
9388
10065
|
});
|
|
9389
10066
|
Object.defineProperty(exports, "optionalAuth", {
|
|
9390
10067
|
enumerable: true,
|
|
9391
|
-
get: function () { return
|
|
10068
|
+
get: function () { return chunkUFPT5KCQ_cjs.optionalAuth; }
|
|
9392
10069
|
});
|
|
9393
10070
|
Object.defineProperty(exports, "performanceLoggingMiddleware", {
|
|
9394
10071
|
enumerable: true,
|
|
9395
|
-
get: function () { return
|
|
10072
|
+
get: function () { return chunkUFPT5KCQ_cjs.performanceLoggingMiddleware; }
|
|
9396
10073
|
});
|
|
9397
10074
|
Object.defineProperty(exports, "requireActivePlugin", {
|
|
9398
10075
|
enumerable: true,
|
|
9399
|
-
get: function () { return
|
|
10076
|
+
get: function () { return chunkUFPT5KCQ_cjs.requireActivePlugin; }
|
|
9400
10077
|
});
|
|
9401
10078
|
Object.defineProperty(exports, "requireActivePlugins", {
|
|
9402
10079
|
enumerable: true,
|
|
9403
|
-
get: function () { return
|
|
10080
|
+
get: function () { return chunkUFPT5KCQ_cjs.requireActivePlugins; }
|
|
9404
10081
|
});
|
|
9405
10082
|
Object.defineProperty(exports, "requireAnyPermission", {
|
|
9406
10083
|
enumerable: true,
|
|
9407
|
-
get: function () { return
|
|
10084
|
+
get: function () { return chunkUFPT5KCQ_cjs.requireAnyPermission; }
|
|
9408
10085
|
});
|
|
9409
10086
|
Object.defineProperty(exports, "requireAuth", {
|
|
9410
10087
|
enumerable: true,
|
|
9411
|
-
get: function () { return
|
|
10088
|
+
get: function () { return chunkUFPT5KCQ_cjs.requireAuth; }
|
|
9412
10089
|
});
|
|
9413
10090
|
Object.defineProperty(exports, "requirePermission", {
|
|
9414
10091
|
enumerable: true,
|
|
9415
|
-
get: function () { return
|
|
10092
|
+
get: function () { return chunkUFPT5KCQ_cjs.requirePermission; }
|
|
9416
10093
|
});
|
|
9417
10094
|
Object.defineProperty(exports, "requireRole", {
|
|
9418
10095
|
enumerable: true,
|
|
9419
|
-
get: function () { return
|
|
10096
|
+
get: function () { return chunkUFPT5KCQ_cjs.requireRole; }
|
|
9420
10097
|
});
|
|
9421
10098
|
Object.defineProperty(exports, "securityHeaders", {
|
|
9422
10099
|
enumerable: true,
|
|
9423
|
-
get: function () { return
|
|
10100
|
+
get: function () { return chunkUFPT5KCQ_cjs.securityHeadersMiddleware; }
|
|
9424
10101
|
});
|
|
9425
10102
|
Object.defineProperty(exports, "securityLoggingMiddleware", {
|
|
9426
10103
|
enumerable: true,
|
|
9427
|
-
get: function () { return
|
|
10104
|
+
get: function () { return chunkUFPT5KCQ_cjs.securityLoggingMiddleware; }
|
|
9428
10105
|
});
|
|
9429
10106
|
Object.defineProperty(exports, "PluginBootstrapService", {
|
|
9430
10107
|
enumerable: true,
|
|
9431
|
-
get: function () { return
|
|
10108
|
+
get: function () { return chunk43AB4EH4_cjs.PluginBootstrapService; }
|
|
9432
10109
|
});
|
|
9433
10110
|
Object.defineProperty(exports, "PluginServiceClass", {
|
|
9434
10111
|
enumerable: true,
|
|
9435
|
-
get: function () { return
|
|
10112
|
+
get: function () { return chunk43AB4EH4_cjs.PluginService; }
|
|
9436
10113
|
});
|
|
9437
10114
|
Object.defineProperty(exports, "backfillFormSubmissions", {
|
|
9438
10115
|
enumerable: true,
|
|
9439
|
-
get: function () { return
|
|
10116
|
+
get: function () { return chunk43AB4EH4_cjs.backfillFormSubmissions; }
|
|
9440
10117
|
});
|
|
9441
10118
|
Object.defineProperty(exports, "cleanupRemovedCollections", {
|
|
9442
10119
|
enumerable: true,
|
|
9443
|
-
get: function () { return
|
|
10120
|
+
get: function () { return chunk43AB4EH4_cjs.cleanupRemovedCollections; }
|
|
9444
10121
|
});
|
|
9445
10122
|
Object.defineProperty(exports, "createContentFromSubmission", {
|
|
9446
10123
|
enumerable: true,
|
|
9447
|
-
get: function () { return
|
|
10124
|
+
get: function () { return chunk43AB4EH4_cjs.createContentFromSubmission; }
|
|
9448
10125
|
});
|
|
9449
10126
|
Object.defineProperty(exports, "deriveCollectionSchemaFromFormio", {
|
|
9450
10127
|
enumerable: true,
|
|
9451
|
-
get: function () { return
|
|
10128
|
+
get: function () { return chunk43AB4EH4_cjs.deriveCollectionSchemaFromFormio; }
|
|
9452
10129
|
});
|
|
9453
10130
|
Object.defineProperty(exports, "deriveSubmissionTitle", {
|
|
9454
10131
|
enumerable: true,
|
|
9455
|
-
get: function () { return
|
|
10132
|
+
get: function () { return chunk43AB4EH4_cjs.deriveSubmissionTitle; }
|
|
9456
10133
|
});
|
|
9457
10134
|
Object.defineProperty(exports, "fullCollectionSync", {
|
|
9458
10135
|
enumerable: true,
|
|
9459
|
-
get: function () { return
|
|
10136
|
+
get: function () { return chunk43AB4EH4_cjs.fullCollectionSync; }
|
|
9460
10137
|
});
|
|
9461
10138
|
Object.defineProperty(exports, "getAvailableCollectionNames", {
|
|
9462
10139
|
enumerable: true,
|
|
9463
|
-
get: function () { return
|
|
10140
|
+
get: function () { return chunk43AB4EH4_cjs.getAvailableCollectionNames; }
|
|
9464
10141
|
});
|
|
9465
10142
|
Object.defineProperty(exports, "getManagedCollections", {
|
|
9466
10143
|
enumerable: true,
|
|
9467
|
-
get: function () { return
|
|
10144
|
+
get: function () { return chunk43AB4EH4_cjs.getManagedCollections; }
|
|
9468
10145
|
});
|
|
9469
10146
|
Object.defineProperty(exports, "isCollectionManaged", {
|
|
9470
10147
|
enumerable: true,
|
|
9471
|
-
get: function () { return
|
|
10148
|
+
get: function () { return chunk43AB4EH4_cjs.isCollectionManaged; }
|
|
9472
10149
|
});
|
|
9473
10150
|
Object.defineProperty(exports, "loadCollectionConfig", {
|
|
9474
10151
|
enumerable: true,
|
|
9475
|
-
get: function () { return
|
|
10152
|
+
get: function () { return chunk43AB4EH4_cjs.loadCollectionConfig; }
|
|
9476
10153
|
});
|
|
9477
10154
|
Object.defineProperty(exports, "loadCollectionConfigs", {
|
|
9478
10155
|
enumerable: true,
|
|
9479
|
-
get: function () { return
|
|
10156
|
+
get: function () { return chunk43AB4EH4_cjs.loadCollectionConfigs; }
|
|
9480
10157
|
});
|
|
9481
10158
|
Object.defineProperty(exports, "mapFormStatusToContentStatus", {
|
|
9482
10159
|
enumerable: true,
|
|
9483
|
-
get: function () { return
|
|
10160
|
+
get: function () { return chunk43AB4EH4_cjs.mapFormStatusToContentStatus; }
|
|
9484
10161
|
});
|
|
9485
10162
|
Object.defineProperty(exports, "registerCollections", {
|
|
9486
10163
|
enumerable: true,
|
|
9487
|
-
get: function () { return
|
|
10164
|
+
get: function () { return chunk43AB4EH4_cjs.registerCollections; }
|
|
9488
10165
|
});
|
|
9489
10166
|
Object.defineProperty(exports, "syncAllFormCollections", {
|
|
9490
10167
|
enumerable: true,
|
|
9491
|
-
get: function () { return
|
|
10168
|
+
get: function () { return chunk43AB4EH4_cjs.syncAllFormCollections; }
|
|
9492
10169
|
});
|
|
9493
10170
|
Object.defineProperty(exports, "syncCollection", {
|
|
9494
10171
|
enumerable: true,
|
|
9495
|
-
get: function () { return
|
|
10172
|
+
get: function () { return chunk43AB4EH4_cjs.syncCollection; }
|
|
9496
10173
|
});
|
|
9497
10174
|
Object.defineProperty(exports, "syncCollections", {
|
|
9498
10175
|
enumerable: true,
|
|
9499
|
-
get: function () { return
|
|
10176
|
+
get: function () { return chunk43AB4EH4_cjs.syncCollections; }
|
|
9500
10177
|
});
|
|
9501
10178
|
Object.defineProperty(exports, "syncFormCollection", {
|
|
9502
10179
|
enumerable: true,
|
|
9503
|
-
get: function () { return
|
|
10180
|
+
get: function () { return chunk43AB4EH4_cjs.syncFormCollection; }
|
|
9504
10181
|
});
|
|
9505
10182
|
Object.defineProperty(exports, "validateCollectionConfig", {
|
|
9506
10183
|
enumerable: true,
|
|
9507
|
-
get: function () { return
|
|
10184
|
+
get: function () { return chunk43AB4EH4_cjs.validateCollectionConfig; }
|
|
9508
10185
|
});
|
|
9509
10186
|
Object.defineProperty(exports, "MigrationService", {
|
|
9510
10187
|
enumerable: true,
|
|
9511
|
-
get: function () { return
|
|
10188
|
+
get: function () { return chunkRVD7PLMU_cjs.MigrationService; }
|
|
9512
10189
|
});
|
|
9513
10190
|
Object.defineProperty(exports, "renderFilterBar", {
|
|
9514
10191
|
enumerable: true,
|
|
9515
|
-
get: function () { return
|
|
10192
|
+
get: function () { return chunk4ZSNJDLS_cjs.renderFilterBar; }
|
|
9516
10193
|
});
|
|
9517
10194
|
Object.defineProperty(exports, "getConfirmationDialogScript", {
|
|
9518
10195
|
enumerable: true,
|
|
9519
|
-
get: function () { return
|
|
10196
|
+
get: function () { return chunkOHYBNCVL_cjs.getConfirmationDialogScript; }
|
|
9520
10197
|
});
|
|
9521
10198
|
Object.defineProperty(exports, "renderAlert", {
|
|
9522
10199
|
enumerable: true,
|
|
9523
|
-
get: function () { return
|
|
10200
|
+
get: function () { return chunkOHYBNCVL_cjs.renderAlert; }
|
|
9524
10201
|
});
|
|
9525
10202
|
Object.defineProperty(exports, "renderConfirmationDialog", {
|
|
9526
10203
|
enumerable: true,
|
|
9527
|
-
get: function () { return
|
|
10204
|
+
get: function () { return chunkOHYBNCVL_cjs.renderConfirmationDialog; }
|
|
9528
10205
|
});
|
|
9529
10206
|
Object.defineProperty(exports, "renderForm", {
|
|
9530
10207
|
enumerable: true,
|
|
9531
|
-
get: function () { return
|
|
10208
|
+
get: function () { return chunkOHYBNCVL_cjs.renderForm; }
|
|
9532
10209
|
});
|
|
9533
10210
|
Object.defineProperty(exports, "renderFormField", {
|
|
9534
10211
|
enumerable: true,
|
|
9535
|
-
get: function () { return
|
|
10212
|
+
get: function () { return chunkOHYBNCVL_cjs.renderFormField; }
|
|
9536
10213
|
});
|
|
9537
10214
|
Object.defineProperty(exports, "renderPagination", {
|
|
9538
10215
|
enumerable: true,
|
|
9539
|
-
get: function () { return
|
|
10216
|
+
get: function () { return chunkOHYBNCVL_cjs.renderPagination; }
|
|
9540
10217
|
});
|
|
9541
10218
|
Object.defineProperty(exports, "renderTable", {
|
|
9542
10219
|
enumerable: true,
|
|
9543
|
-
get: function () { return
|
|
10220
|
+
get: function () { return chunkOHYBNCVL_cjs.renderTable; }
|
|
9544
10221
|
});
|
|
9545
10222
|
Object.defineProperty(exports, "HookSystemImpl", {
|
|
9546
10223
|
enumerable: true,
|
|
9547
|
-
get: function () { return
|
|
10224
|
+
get: function () { return chunkABB34XUS_cjs.HookSystemImpl; }
|
|
9548
10225
|
});
|
|
9549
10226
|
Object.defineProperty(exports, "HookUtils", {
|
|
9550
10227
|
enumerable: true,
|
|
9551
|
-
get: function () { return
|
|
10228
|
+
get: function () { return chunkABB34XUS_cjs.HookUtils; }
|
|
9552
10229
|
});
|
|
9553
10230
|
Object.defineProperty(exports, "PluginManagerClass", {
|
|
9554
10231
|
enumerable: true,
|
|
9555
|
-
get: function () { return
|
|
10232
|
+
get: function () { return chunkABB34XUS_cjs.PluginManager; }
|
|
9556
10233
|
});
|
|
9557
10234
|
Object.defineProperty(exports, "PluginRegistryImpl", {
|
|
9558
10235
|
enumerable: true,
|
|
9559
|
-
get: function () { return
|
|
10236
|
+
get: function () { return chunkABB34XUS_cjs.PluginRegistryImpl; }
|
|
9560
10237
|
});
|
|
9561
10238
|
Object.defineProperty(exports, "PluginValidatorClass", {
|
|
9562
10239
|
enumerable: true,
|
|
9563
|
-
get: function () { return
|
|
10240
|
+
get: function () { return chunkABB34XUS_cjs.PluginValidator; }
|
|
9564
10241
|
});
|
|
9565
10242
|
Object.defineProperty(exports, "ScopedHookSystemClass", {
|
|
9566
10243
|
enumerable: true,
|
|
9567
|
-
get: function () { return
|
|
10244
|
+
get: function () { return chunkABB34XUS_cjs.ScopedHookSystem; }
|
|
9568
10245
|
});
|
|
9569
10246
|
Object.defineProperty(exports, "PluginBuilder", {
|
|
9570
10247
|
enumerable: true,
|
|
9571
|
-
get: function () { return
|
|
10248
|
+
get: function () { return chunk635JAMSE_cjs.PluginBuilder; }
|
|
9572
10249
|
});
|
|
9573
10250
|
Object.defineProperty(exports, "PluginHelpers", {
|
|
9574
10251
|
enumerable: true,
|
|
9575
|
-
get: function () { return
|
|
10252
|
+
get: function () { return chunk635JAMSE_cjs.PluginHelpers; }
|
|
9576
10253
|
});
|
|
9577
10254
|
Object.defineProperty(exports, "QueryFilterBuilder", {
|
|
9578
10255
|
enumerable: true,
|
|
9579
|
-
get: function () { return
|
|
10256
|
+
get: function () { return chunkVUISYUHY_cjs.QueryFilterBuilder; }
|
|
9580
10257
|
});
|
|
9581
10258
|
Object.defineProperty(exports, "SONICJS_VERSION", {
|
|
9582
10259
|
enumerable: true,
|
|
9583
|
-
get: function () { return
|
|
10260
|
+
get: function () { return chunkVUISYUHY_cjs.SONICJS_VERSION; }
|
|
9584
10261
|
});
|
|
9585
10262
|
Object.defineProperty(exports, "TemplateRenderer", {
|
|
9586
10263
|
enumerable: true,
|
|
9587
|
-
get: function () { return
|
|
10264
|
+
get: function () { return chunkVUISYUHY_cjs.TemplateRenderer; }
|
|
9588
10265
|
});
|
|
9589
10266
|
Object.defineProperty(exports, "buildQuery", {
|
|
9590
10267
|
enumerable: true,
|
|
9591
|
-
get: function () { return
|
|
10268
|
+
get: function () { return chunkVUISYUHY_cjs.buildQuery; }
|
|
9592
10269
|
});
|
|
9593
10270
|
Object.defineProperty(exports, "getCoreVersion", {
|
|
9594
10271
|
enumerable: true,
|
|
9595
|
-
get: function () { return
|
|
10272
|
+
get: function () { return chunkVUISYUHY_cjs.getCoreVersion; }
|
|
9596
10273
|
});
|
|
9597
10274
|
Object.defineProperty(exports, "renderTemplate", {
|
|
9598
10275
|
enumerable: true,
|
|
9599
|
-
get: function () { return
|
|
10276
|
+
get: function () { return chunkVUISYUHY_cjs.renderTemplate; }
|
|
9600
10277
|
});
|
|
9601
10278
|
Object.defineProperty(exports, "templateRenderer", {
|
|
9602
10279
|
enumerable: true,
|
|
9603
|
-
get: function () { return
|
|
10280
|
+
get: function () { return chunkVUISYUHY_cjs.templateRenderer; }
|
|
9604
10281
|
});
|
|
9605
10282
|
Object.defineProperty(exports, "metricsTracker", {
|
|
9606
10283
|
enumerable: true,
|