@sonicjs-cms/core 3.0.0-beta.13 → 3.0.0-beta.15

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.
Files changed (107) hide show
  1. package/dist/{app-Bo0X1OWX.d.ts → app-01M0dIwt.d.ts} +1 -1
  2. package/dist/{app-Do66yCcV.d.cts → app-aj39TGHB.d.cts} +1 -1
  3. package/dist/{chunk-YNYEQP3K.cjs → chunk-4AB3PQHF.cjs} +2 -2
  4. package/dist/{chunk-YNYEQP3K.cjs.map → chunk-4AB3PQHF.cjs.map} +1 -1
  5. package/dist/{chunk-KG6GQE6B.js → chunk-4ENXIP4M.js} +27 -2
  6. package/dist/chunk-4ENXIP4M.js.map +1 -0
  7. package/dist/{chunk-6KFX4LAT.js → chunk-75WXXLAU.js} +4 -4
  8. package/dist/{chunk-6KFX4LAT.js.map → chunk-75WXXLAU.js.map} +1 -1
  9. package/dist/{chunk-VT77YUTP.cjs → chunk-BDQOPRA3.cjs} +441 -249
  10. package/dist/chunk-BDQOPRA3.cjs.map +1 -0
  11. package/dist/{chunk-PPFQDMZE.js → chunk-CE6POA7A.js} +3 -3
  12. package/dist/{chunk-PPFQDMZE.js.map → chunk-CE6POA7A.js.map} +1 -1
  13. package/dist/{chunk-IM3UG4QW.cjs → chunk-FVI3H6RG.cjs} +10 -10
  14. package/dist/{chunk-IM3UG4QW.cjs.map → chunk-FVI3H6RG.cjs.map} +1 -1
  15. package/dist/{chunk-KPQ57HAH.cjs → chunk-FXZSZ7C7.cjs} +27 -2
  16. package/dist/chunk-FXZSZ7C7.cjs.map +1 -0
  17. package/dist/{chunk-BK3NB35S.js → chunk-GQXVDFIG.js} +35 -13
  18. package/dist/chunk-GQXVDFIG.js.map +1 -0
  19. package/dist/{chunk-IVPRUGTY.js → chunk-IQZA2OY5.js} +4 -4
  20. package/dist/{chunk-IVPRUGTY.js.map → chunk-IQZA2OY5.js.map} +1 -1
  21. package/dist/{chunk-EKMN6W5B.js → chunk-JRLADH5B.js} +3 -3
  22. package/dist/{chunk-EKMN6W5B.js.map → chunk-JRLADH5B.js.map} +1 -1
  23. package/dist/{chunk-NUKJ54GA.cjs → chunk-KMCLNO4K.cjs} +6 -6
  24. package/dist/{chunk-NUKJ54GA.cjs.map → chunk-KMCLNO4K.cjs.map} +1 -1
  25. package/dist/{chunk-3FBZFYSQ.js → chunk-L3VIH6U4.js} +210 -19
  26. package/dist/chunk-L3VIH6U4.js.map +1 -0
  27. package/dist/{chunk-BLMTL57B.js → chunk-PDC7DLOV.js} +21 -3
  28. package/dist/chunk-PDC7DLOV.js.map +1 -0
  29. package/dist/{chunk-6CKXZFED.cjs → chunk-PK3ODTAL.cjs} +3 -3
  30. package/dist/{chunk-6CKXZFED.cjs.map → chunk-PK3ODTAL.cjs.map} +1 -1
  31. package/dist/{chunk-PZGGIJI6.cjs → chunk-PTTFLUEX.cjs} +4 -4
  32. package/dist/{chunk-PZGGIJI6.cjs.map → chunk-PTTFLUEX.cjs.map} +1 -1
  33. package/dist/{chunk-IV3NA6WZ.js → chunk-VOAP3KFU.js} +2 -2
  34. package/dist/{chunk-IV3NA6WZ.js.map → chunk-VOAP3KFU.js.map} +1 -1
  35. package/dist/{chunk-IESEVHXL.js → chunk-VVYVFCML.js} +12 -3
  36. package/dist/chunk-VVYVFCML.js.map +1 -0
  37. package/dist/{chunk-2CB4KY7I.cjs → chunk-W36OZTJ5.cjs} +21 -3
  38. package/dist/chunk-W36OZTJ5.cjs.map +1 -0
  39. package/dist/{chunk-HIKBY7MS.cjs → chunk-XWVDSM2L.cjs} +12 -3
  40. package/dist/chunk-XWVDSM2L.cjs.map +1 -0
  41. package/dist/{chunk-VMBQ6NQB.cjs → chunk-ZBDDZYA3.cjs} +45 -23
  42. package/dist/chunk-ZBDDZYA3.cjs.map +1 -0
  43. package/dist/{collection-config-JgHOpFCG.d.ts → collection-config-BTzAvKt2.d.cts} +25 -0
  44. package/dist/{collection-config-JgHOpFCG.d.cts → collection-config-BTzAvKt2.d.ts} +25 -0
  45. package/dist/config-SM2UWSDN.js +6 -0
  46. package/dist/{config-HFXANXCC.js.map → config-SM2UWSDN.js.map} +1 -1
  47. package/dist/config-YCRSU7ZP.cjs +19 -0
  48. package/dist/{config-ON6FNMYX.cjs.map → config-YCRSU7ZP.cjs.map} +1 -1
  49. package/dist/{define-plugin-BzNHc1ZI.d.ts → define-plugin-BYIey6sp.d.ts} +1 -1
  50. package/dist/{define-plugin-IWDKYaVm.d.cts → define-plugin-DsKiGu1q.d.cts} +1 -1
  51. package/dist/index.cjs +772 -314
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +21 -10
  54. package/dist/index.d.ts +21 -10
  55. package/dist/index.js +517 -61
  56. package/dist/index.js.map +1 -1
  57. package/dist/middleware.cjs +34 -33
  58. package/dist/middleware.d.cts +2 -2
  59. package/dist/middleware.d.ts +2 -2
  60. package/dist/middleware.js +5 -4
  61. package/dist/migrations-6R2N6G2P.js +4 -0
  62. package/dist/{migrations-KKLQ2CEF.js.map → migrations-6R2N6G2P.js.map} +1 -1
  63. package/dist/migrations-X3UX24QG.cjs +13 -0
  64. package/dist/{migrations-XOXYLHHU.cjs.map → migrations-X3UX24QG.cjs.map} +1 -1
  65. package/dist/{plugin-bootstrap-B8ThJU21.d.cts → plugin-bootstrap-BHWQ2df8.d.cts} +1 -1
  66. package/dist/{plugin-bootstrap-qu8hJgUt.d.ts → plugin-bootstrap-Bj4fxX1q.d.ts} +1 -1
  67. package/dist/plugins.cjs +40 -40
  68. package/dist/plugins.d.cts +2 -2
  69. package/dist/plugins.d.ts +2 -2
  70. package/dist/plugins.js +3 -3
  71. package/dist/rbac-4QLDXIDF.js +5 -0
  72. package/dist/{rbac-O73MFKDA.js.map → rbac-4QLDXIDF.js.map} +1 -1
  73. package/dist/rbac-ESTOCVT2.cjs +14 -0
  74. package/dist/{rbac-VONLJJKB.cjs.map → rbac-ESTOCVT2.cjs.map} +1 -1
  75. package/dist/routes.cjs +28 -28
  76. package/dist/routes.d.cts +2 -2
  77. package/dist/routes.d.ts +2 -2
  78. package/dist/routes.js +8 -8
  79. package/dist/services.cjs +18 -18
  80. package/dist/services.d.cts +2 -2
  81. package/dist/services.d.ts +2 -2
  82. package/dist/services.js +2 -2
  83. package/dist/{types-Dea1eNxU.d.ts → types-DT7XN5TX.d.cts} +1 -1
  84. package/dist/{types-Dea1eNxU.d.cts → types-DT7XN5TX.d.ts} +1 -1
  85. package/dist/types.d.cts +1 -1
  86. package/dist/types.d.ts +1 -1
  87. package/dist/utils.cjs +3 -3
  88. package/dist/utils.d.cts +1 -1
  89. package/dist/utils.d.ts +1 -1
  90. package/dist/utils.js +1 -1
  91. package/package.json +1 -1
  92. package/dist/chunk-2CB4KY7I.cjs.map +0 -1
  93. package/dist/chunk-3FBZFYSQ.js.map +0 -1
  94. package/dist/chunk-BK3NB35S.js.map +0 -1
  95. package/dist/chunk-BLMTL57B.js.map +0 -1
  96. package/dist/chunk-HIKBY7MS.cjs.map +0 -1
  97. package/dist/chunk-IESEVHXL.js.map +0 -1
  98. package/dist/chunk-KG6GQE6B.js.map +0 -1
  99. package/dist/chunk-KPQ57HAH.cjs.map +0 -1
  100. package/dist/chunk-VMBQ6NQB.cjs.map +0 -1
  101. package/dist/chunk-VT77YUTP.cjs.map +0 -1
  102. package/dist/config-HFXANXCC.js +0 -6
  103. package/dist/config-ON6FNMYX.cjs +0 -19
  104. package/dist/migrations-KKLQ2CEF.js +0 -4
  105. package/dist/migrations-XOXYLHHU.cjs +0 -13
  106. package/dist/rbac-O73MFKDA.js +0 -5
  107. package/dist/rbac-VONLJJKB.cjs +0 -14
@@ -1,18 +1,18 @@
1
- import { isFirstUserRegistration, isRegistrationEnabled, authValidationService } from './chunk-IESEVHXL.js';
1
+ import { isFirstUserRegistration, isRegistrationEnabled, authValidationService } from './chunk-VVYVFCML.js';
2
2
  import { renderDocumentFormPage, renderAlert } from './chunk-RMRJGMDE.js';
3
3
  import { getCacheService, CACHE_CONFIGS, SettingsService, getLogger, getAppInstance, buildRouteList, CATEGORY_INFO } from './chunk-RQ6N3FTV.js';
4
- import { DocumentTypeRegistry, requireAuth, requireRole, optionalAuth, isPluginActive, rateLimit, AuthManager, getJwtExpirySecondsFromDb, getJwtRefreshGraceSecondsFromDb, logActivity, generateCsrfToken } from './chunk-BK3NB35S.js';
5
- import { DocumentsService, documentSecondsToMs, RbacService } from './chunk-BLMTL57B.js';
4
+ import { DocumentTypeRegistry, requireAuth, requireRole, optionalAuth, isPluginActive, rateLimit, AuthManager, getJwtExpirySecondsFromDb, getJwtRefreshGraceSecondsFromDb, logActivity, generateCsrfToken } from './chunk-GQXVDFIG.js';
5
+ import { DocumentsService, documentSecondsToMs, RbacService } from './chunk-PDC7DLOV.js';
6
6
  import { nanoid } from './chunk-GCDZZNIN.js';
7
- import { getCollectionRegistry, collectionRecordToRow, loadCollectionConfigs, getVisibleCollections, PluginService, PLUGIN_REGISTRY, findPluginByCodeName, isCodeCollectionInternal, isDbDocTypeInternal, invalidateTenantCache } from './chunk-KG6GQE6B.js';
8
- import { MigrationService } from './chunk-IV3NA6WZ.js';
7
+ import { getCollectionRegistry, collectionRecordToRow, loadCollectionConfigs, getVisibleCollections, PluginService, PLUGIN_REGISTRY, findPluginByCodeName, isCodeCollectionInternal, isDbDocTypeInternal, invalidateTenantCache } from './chunk-4ENXIP4M.js';
8
+ import { MigrationService } from './chunk-VOAP3KFU.js';
9
9
  import { renderCheckboxPage, renderAlert as renderAlert$1, renderTable, renderPagination, renderConfirmationDialog, getConfirmationDialogScript, renderAdminLayout, adminLayoutV2, renderForm } from './chunk-OBA2RYZN.js';
10
10
  import { init_admin_layout_catalyst_template, renderAdminLayoutCatalyst } from './chunk-5V62WT6M.js';
11
- import { createServiceSingleton, definePlugin, getPluginDefinition, applySchemaDefaults, renderSchemaFields, parseFormDataToSettings } from './chunk-EKMN6W5B.js';
11
+ import { createServiceSingleton, definePlugin, getPluginDefinition, applySchemaDefaults, renderSchemaFields, parseFormDataToSettings } from './chunk-JRLADH5B.js';
12
12
  import { hasHookSystem, getTypedHooks } from './chunk-RNZFGN4R.js';
13
13
  import { QueryFilterBuilder, getBlocksFieldConfig, parseBlocksValue } from './chunk-QZGABF2M.js';
14
14
  import { metricsTracker } from './chunk-FICTAGD4.js';
15
- import { getCoreVersion } from './chunk-PPFQDMZE.js';
15
+ import { getCoreVersion } from './chunk-CE6POA7A.js';
16
16
  import { escapeHtml, sanitizeRichText, sanitizeInput } from './chunk-TQABQWOP.js';
17
17
  import { Hono } from 'hono';
18
18
  import { z } from 'zod';
@@ -3389,7 +3389,7 @@ adminApiRoutes.patch("/collections/:id", collectionsReadOnly);
3389
3389
  adminApiRoutes.delete("/collections/:id", collectionsReadOnly);
3390
3390
  adminApiRoutes.get("/migrations/status", async (c) => {
3391
3391
  try {
3392
- const { MigrationService: MigrationService2 } = await import('./migrations-KKLQ2CEF.js');
3392
+ const { MigrationService: MigrationService2 } = await import('./migrations-6R2N6G2P.js');
3393
3393
  const db = c.env.DB;
3394
3394
  const migrationService = new MigrationService2(db);
3395
3395
  const status = await migrationService.getMigrationStatus();
@@ -3432,7 +3432,7 @@ adminApiRoutes.post("/migrations/run", async (c) => {
3432
3432
  });
3433
3433
  adminApiRoutes.get("/migrations/validate", async (c) => {
3434
3434
  try {
3435
- const { MigrationService: MigrationService2 } = await import('./migrations-KKLQ2CEF.js');
3435
+ const { MigrationService: MigrationService2 } = await import('./migrations-6R2N6G2P.js');
3436
3436
  const db = c.env.DB;
3437
3437
  const migrationService = new MigrationService2(db);
3438
3438
  const validation = await migrationService.validateSchema();
@@ -3591,7 +3591,7 @@ function renderLoginPage(data, demoLoginActive = false) {
3591
3591
  <!-- Form -->
3592
3592
  <form
3593
3593
  id="login-form"
3594
- hx-post="/auth/login/form"
3594
+ hx-post="/auth/login/form${data.redirect ? `?redirect=${encodeURIComponent(data.redirect)}` : ""}"
3595
3595
  hx-target="#form-response"
3596
3596
  hx-swap="innerHTML"
3597
3597
  class="space-y-6"
@@ -5579,6 +5579,79 @@ function renderDynamicField(field, options = {}) {
5579
5579
  `;
5580
5580
  break;
5581
5581
  }
5582
+ case "json": {
5583
+ const jsonParsedValue = value !== null && value !== void 0 && typeof value !== "string" ? value : typeof value === "string" && value !== "" ? (() => {
5584
+ try {
5585
+ return JSON.parse(value);
5586
+ } catch {
5587
+ return value;
5588
+ }
5589
+ })() : null;
5590
+ const jsonDisplayValue = jsonParsedValue !== null && typeof jsonParsedValue !== "string" ? JSON.stringify(jsonParsedValue, null, 2) : typeof jsonParsedValue === "string" ? jsonParsedValue : "";
5591
+ const viewerId = `${fieldId}-viewer`;
5592
+ const textareaId = `${fieldId}-textarea`;
5593
+ const jsonDataAttr = escapeHtml2(JSON.stringify(jsonParsedValue ?? null));
5594
+ const isEmpty = jsonParsedValue === null || jsonDisplayValue === "";
5595
+ if (disabled) {
5596
+ fieldHTML = `
5597
+ <div
5598
+ id="${viewerId}"
5599
+ class="json-viewer-host rounded-lg px-3 py-2 text-xs bg-white dark:bg-zinc-800 shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 min-h-[2.5rem] overflow-auto"
5600
+ data-json-viewer
5601
+ data-json="${jsonDataAttr}"
5602
+ data-open="${opts.open ?? 2}"
5603
+ >${isEmpty ? '<span class="text-zinc-400 dark:text-zinc-500 italic">empty</span>' : ""}</div>
5604
+ ${getJsonViewerScript()}
5605
+ `;
5606
+ } else {
5607
+ fieldHTML = `
5608
+ <div class="json-field-wrapper space-y-2">
5609
+ <div class="flex items-center justify-end">
5610
+ <button
5611
+ type="button"
5612
+ id="${fieldId}-toggle"
5613
+ class="text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 underline transition-colors"
5614
+ data-json-toggle
5615
+ data-viewer="${viewerId}"
5616
+ data-textarea="${textareaId}"
5617
+ data-hidden-input="${fieldId}"
5618
+ >Edit JSON</button>
5619
+ </div>
5620
+
5621
+ <div
5622
+ id="${viewerId}"
5623
+ class="json-viewer-host rounded-lg px-3 py-2 text-xs bg-white dark:bg-zinc-800 shadow-sm ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 min-h-[2.5rem] overflow-auto"
5624
+ data-json-viewer
5625
+ data-json="${jsonDataAttr}"
5626
+ data-open="${opts.open ?? 2}"
5627
+ >${isEmpty ? '<span class="text-zinc-400 dark:text-zinc-500 italic">empty \u2014 click &quot;Edit JSON&quot; to add data</span>' : ""}</div>
5628
+
5629
+ <textarea
5630
+ id="${textareaId}"
5631
+ rows="${opts.rows || 8}"
5632
+ placeholder="${opts.placeholder || "{}"}"
5633
+ class="${baseClasses} ${errorClasses} resize-y font-mono text-xs hidden"
5634
+ aria-label="${escapeHtml2(field.field_label)}"
5635
+ data-json-edit-area
5636
+ data-viewer="${viewerId}"
5637
+ data-hidden-input="${fieldId}"
5638
+ >${escapeHtml2(jsonDisplayValue)}</textarea>
5639
+
5640
+ <input
5641
+ type="hidden"
5642
+ id="${fieldId}"
5643
+ name="${fieldName}"
5644
+ value="${escapeHtml2(jsonDisplayValue)}"
5645
+ ${required}
5646
+ >
5647
+
5648
+ <div id="${fieldId}-json-error" class="text-xs text-pink-500 dark:text-pink-400 hidden"></div>
5649
+ </div>
5650
+ ${getJsonViewerScript()}
5651
+ `;
5652
+ }
5653
+ break;
5654
+ }
5582
5655
  default:
5583
5656
  fieldHTML = `
5584
5657
  <input
@@ -6075,6 +6148,120 @@ function normalizeBlockField(fieldConfig, fieldName) {
6075
6148
  options
6076
6149
  };
6077
6150
  }
6151
+ function getJsonViewerScript() {
6152
+ return `
6153
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/json-formatter-js@2.5.23/dist/json-formatter.min.css" id="json-formatter-css" onload="this.removeAttribute('onload')" onerror="">
6154
+ <script>
6155
+ (function() {
6156
+ var JS_URL = 'https://cdn.jsdelivr.net/npm/json-formatter-js@2.5.23/dist/json-formatter.umd.min.js';
6157
+
6158
+ function isDark() {
6159
+ return document.documentElement.classList.contains('dark') ||
6160
+ document.documentElement.dataset.theme === 'dark' ||
6161
+ window.matchMedia('(prefers-color-scheme: dark)').matches;
6162
+ }
6163
+
6164
+ function initViewer(el) {
6165
+ var raw = el.dataset.json;
6166
+ var open = parseInt(el.dataset.open || '2', 10);
6167
+ if (!raw || raw === 'null') return;
6168
+ var data;
6169
+ try { data = JSON.parse(raw); } catch(e) { el.textContent = raw; return; }
6170
+ var fmt = new JSONFormatter(data, open, {
6171
+ hoverPreviewEnabled: true,
6172
+ hoverPreviewArrayCount: 5,
6173
+ hoverPreviewFieldCount: 5,
6174
+ theme: isDark() ? 'dark' : '',
6175
+ animateOpen: true,
6176
+ animateClose: true,
6177
+ });
6178
+ el.innerHTML = '';
6179
+ el.appendChild(fmt.render());
6180
+ }
6181
+
6182
+ function initAllViewers() {
6183
+ document.querySelectorAll('[data-json-viewer]').forEach(function(el) { initViewer(el); });
6184
+ }
6185
+
6186
+ function ensureLoaded(cb) {
6187
+ if (window.JSONFormatter) { cb(); return; }
6188
+ if (window.__jsonFormatterCallbacks) { window.__jsonFormatterCallbacks.push(cb); return; }
6189
+ window.__jsonFormatterCallbacks = [cb];
6190
+ var s = document.createElement('script');
6191
+ s.src = JS_URL;
6192
+ s.onload = function() {
6193
+ (window.__jsonFormatterCallbacks || []).forEach(function(fn) { fn(); });
6194
+ window.__jsonFormatterCallbacks = null;
6195
+ };
6196
+ document.head.appendChild(s);
6197
+ }
6198
+
6199
+ if (!window.__sonicJsonViewerInit) {
6200
+ window.__sonicJsonViewerInit = true;
6201
+
6202
+ // Toggle between viewer and edit textarea
6203
+ document.addEventListener('click', function(e) {
6204
+ var btn = e.target.closest('[data-json-toggle]');
6205
+ if (!btn) return;
6206
+ var viewerId = btn.dataset.viewer;
6207
+ var textareaId = btn.dataset.textarea;
6208
+ var hiddenId = btn.dataset.hiddenInput;
6209
+ var viewer = document.getElementById(viewerId);
6210
+ var textarea = document.getElementById(textareaId);
6211
+ var hidden = document.getElementById(hiddenId);
6212
+ var errorEl = hidden ? document.getElementById(hiddenId + '-json-error') : null;
6213
+ if (!viewer || !textarea) return;
6214
+ var isEditing = !textarea.classList.contains('hidden');
6215
+ if (isEditing) {
6216
+ // Switching back to viewer \u2014 validate + refresh
6217
+ var raw = textarea.value.trim();
6218
+ if (raw) {
6219
+ try {
6220
+ var parsed = JSON.parse(raw);
6221
+ if (hidden) hidden.value = raw;
6222
+ viewer.dataset.json = JSON.stringify(parsed);
6223
+ ensureLoaded(function() { initViewer(viewer); });
6224
+ if (errorEl) { errorEl.textContent = ''; errorEl.classList.add('hidden'); }
6225
+ } catch(ex) {
6226
+ if (errorEl) { errorEl.textContent = 'Invalid JSON: ' + ex.message; errorEl.classList.remove('hidden'); }
6227
+ return;
6228
+ }
6229
+ } else {
6230
+ if (hidden) hidden.value = '';
6231
+ viewer.innerHTML = '<span class="text-zinc-400 dark:text-zinc-500 italic">empty</span>';
6232
+ }
6233
+ textarea.classList.add('hidden');
6234
+ viewer.classList.remove('hidden');
6235
+ btn.textContent = 'Edit JSON';
6236
+ } else {
6237
+ // Switching to edit \u2014 populate textarea from hidden input
6238
+ if (hidden && hidden.value) {
6239
+ try {
6240
+ textarea.value = JSON.stringify(JSON.parse(hidden.value), null, 2);
6241
+ } catch(e) {
6242
+ textarea.value = hidden.value;
6243
+ }
6244
+ }
6245
+ viewer.classList.add('hidden');
6246
+ textarea.classList.remove('hidden');
6247
+ btn.textContent = 'Preview';
6248
+ }
6249
+ });
6250
+ }
6251
+
6252
+ function run() {
6253
+ ensureLoaded(initAllViewers);
6254
+ }
6255
+
6256
+ if (document.readyState === 'loading') {
6257
+ document.addEventListener('DOMContentLoaded', run);
6258
+ } else {
6259
+ run();
6260
+ }
6261
+ })();
6262
+ </script>
6263
+ `;
6264
+ }
6078
6265
  function getStructuredFieldScript() {
6079
6266
  return `
6080
6267
  ${getReadFieldValueScript()}
@@ -6935,10 +7122,12 @@ var authRoutes = new Hono();
6935
7122
  authRoutes.get("/login", async (c) => {
6936
7123
  const error = c.req.query("error");
6937
7124
  const message = c.req.query("message");
7125
+ const redirect = c.req.query("redirect");
6938
7126
  const pageData = {
6939
7127
  error: error || void 0,
6940
7128
  message: message || void 0,
6941
- version: c.get("appVersion")
7129
+ version: c.get("appVersion"),
7130
+ redirect: redirect && redirect.startsWith("/") ? redirect : void 0
6942
7131
  };
6943
7132
  const db = c.env.DB;
6944
7133
  let demoLoginActive = false;
@@ -7082,7 +7271,7 @@ authRoutes.post(
7082
7271
  }
7083
7272
  const { email, password } = validation.data;
7084
7273
  const normalizedEmail = email.toLowerCase();
7085
- const { createAuth } = await import('./config-HFXANXCC.js');
7274
+ const { createAuth } = await import('./config-SM2UWSDN.js');
7086
7275
  const auth = createAuth(c.env);
7087
7276
  const baReq = new Request(new URL("/auth/sign-in/email", c.req.url).href, {
7088
7277
  method: "POST",
@@ -7136,7 +7325,7 @@ authRoutes.post(
7136
7325
  );
7137
7326
  authRoutes.post("/logout", async (c) => {
7138
7327
  try {
7139
- const { createAuth } = await import('./config-HFXANXCC.js');
7328
+ const { createAuth } = await import('./config-SM2UWSDN.js');
7140
7329
  const auth = createAuth(c.env);
7141
7330
  const baReq = new Request(new URL("/auth/sign-out", c.req.url).href, {
7142
7331
  method: "POST",
@@ -7152,7 +7341,7 @@ authRoutes.post("/logout", async (c) => {
7152
7341
  });
7153
7342
  authRoutes.get("/logout", async (c) => {
7154
7343
  try {
7155
- const { createAuth } = await import('./config-HFXANXCC.js');
7344
+ const { createAuth } = await import('./config-SM2UWSDN.js');
7156
7345
  const auth = createAuth(c.env);
7157
7346
  const baReq = new Request(new URL("/auth/sign-out", c.req.url).href, {
7158
7347
  method: "POST",
@@ -7359,7 +7548,7 @@ authRoutes.post(
7359
7548
  </div>
7360
7549
  `);
7361
7550
  }
7362
- const { createAuth } = await import('./config-HFXANXCC.js');
7551
+ const { createAuth } = await import('./config-SM2UWSDN.js');
7363
7552
  const auth = createAuth(c.env);
7364
7553
  const baReq = new Request(new URL("/auth/sign-in/email", c.req.url).href, {
7365
7554
  method: "POST",
@@ -7383,6 +7572,8 @@ authRoutes.post(
7383
7572
  }
7384
7573
  }
7385
7574
  await setCsrfCookie(c);
7575
+ const rawRedirect = c.req.query("redirect");
7576
+ const redirectUrl = rawRedirect && rawRedirect.startsWith("/") ? rawRedirect : "/admin/content";
7386
7577
  return c.html(html`
7387
7578
  <div id="form-response">
7388
7579
  <div class="rounded-lg bg-green-100 dark:bg-lime-500/10 p-4 ring-1 ring-green-400 dark:ring-lime-500/20">
@@ -7395,7 +7586,7 @@ authRoutes.post(
7395
7586
  </div>
7396
7587
  </div>
7397
7588
  <script>
7398
- setTimeout(() => { window.location.href = '/admin/content'; }, 500);
7589
+ setTimeout(() => { window.location.href = '${redirectUrl}'; }, 500);
7399
7590
  </script>
7400
7591
  </div>
7401
7592
  </div>
@@ -26642,6 +26833,6 @@ var ROUTES_INFO = {
26642
26833
  reference: "https://github.com/sonicjs/sonicjs"
26643
26834
  };
26644
26835
 
26645
- export { DocumentRepository, ROUTES_INFO, TenantService, VALID_MEMBER_ROLES, adminCheckboxRoutes, adminCollectionsRoutes, adminDocumentsRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, admin_api_default, admin_content_default, apiDocumentsRoutes, api_content_crud_default, api_default, api_media_default, api_system_default, auth_default, createUserProfilesPlugin, defineUserProfile, denyIfNotAllowed, dispatchHookEvent, getConfirmationDialogScript2 as getConfirmationDialogScript, getCustomData, getEmailService, getUserProfileConfig, getVariablesCached, hasEmailService, invalidateVariablesCache, isValidMemberRole, lexicalEditorPlugin, renderConfirmationDialog2 as renderConfirmationDialog, renderTable2 as renderTable, resolveDocScope, resolveVariablesInObject, router, router2, setEmailService, setVariablesCache, test_cleanup_default, userProfilesPlugin, userRoutes };
26646
- //# sourceMappingURL=chunk-3FBZFYSQ.js.map
26647
- //# sourceMappingURL=chunk-3FBZFYSQ.js.map
26836
+ export { DocumentRepository, ROUTES_INFO, TenantService, VALID_MEMBER_ROLES, adminCheckboxRoutes, adminCollectionsRoutes, adminDocumentsRoutes, adminLogsRoutes, adminMediaRoutes, adminPluginRoutes, adminSettingsRoutes, admin_api_default, admin_content_default, apiDocumentsRoutes, api_content_crud_default, api_default, api_media_default, api_system_default, auth_default, createDocumentSchema, createUserProfilesPlugin, defineUserProfile, denyIfNotAllowed, dispatchHookEvent, getConfirmationDialogScript2 as getConfirmationDialogScript, getCustomData, getEmailService, getUserProfileConfig, getVariablesCached, hasEmailService, invalidateVariablesCache, isValidMemberRole, lexicalEditorPlugin, renderConfirmationDialog2 as renderConfirmationDialog, renderTable2 as renderTable, resolveDocScope, resolveVariablesInObject, router, router2, setEmailService, setVariablesCache, test_cleanup_default, userProfilesPlugin, userRoutes };
26837
+ //# sourceMappingURL=chunk-L3VIH6U4.js.map
26838
+ //# sourceMappingURL=chunk-L3VIH6U4.js.map