@sonicjs-cms/core 2.0.10 → 2.2.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.
Files changed (75) hide show
  1. package/dist/{chunk-Q7SL7U43.cjs → chunk-2DIWLDCA.cjs} +12001 -10740
  2. package/dist/chunk-2DIWLDCA.cjs.map +1 -0
  3. package/dist/{chunk-LW33AOBF.js → chunk-5RKQB2JG.js} +6 -222
  4. package/dist/chunk-5RKQB2JG.js.map +1 -0
  5. package/dist/{chunk-DOR2IU73.cjs → chunk-AINTFRTC.cjs} +2 -2
  6. package/dist/{chunk-DOR2IU73.cjs.map → chunk-AINTFRTC.cjs.map} +1 -1
  7. package/dist/chunk-HV2I6API.cjs +1049 -0
  8. package/dist/chunk-HV2I6API.cjs.map +1 -0
  9. package/dist/chunk-K4Z3IHOK.js +1031 -0
  10. package/dist/chunk-K4Z3IHOK.js.map +1 -0
  11. package/dist/{chunk-6FR25MPC.js → chunk-L232U757.js} +2 -2
  12. package/dist/{chunk-6FR25MPC.js.map → chunk-L232U757.js.map} +1 -1
  13. package/dist/chunk-NMVOTNSL.js +61 -0
  14. package/dist/chunk-NMVOTNSL.js.map +1 -0
  15. package/dist/{chunk-YHG45LMU.js → chunk-OORGXYDA.js} +48 -5
  16. package/dist/chunk-OORGXYDA.js.map +1 -0
  17. package/dist/{chunk-FTMKKKNH.js → chunk-QNWYQZ55.js} +3 -3
  18. package/dist/{chunk-FTMKKKNH.js.map → chunk-QNWYQZ55.js.map} +1 -1
  19. package/dist/{chunk-Z4H6DBVF.js → chunk-R57VFNP3.js} +11991 -10731
  20. package/dist/chunk-R57VFNP3.js.map +1 -0
  21. package/dist/{chunk-COBUPOMD.js → chunk-T7IYBGGO.cjs} +5 -770
  22. package/dist/chunk-T7IYBGGO.cjs.map +1 -0
  23. package/dist/{chunk-HXA5QSI3.cjs → chunk-UEYMFNBN.cjs} +51 -6
  24. package/dist/chunk-UEYMFNBN.cjs.map +1 -0
  25. package/dist/chunk-WBX5YMTB.cjs +70 -0
  26. package/dist/chunk-WBX5YMTB.cjs.map +1 -0
  27. package/dist/{chunk-3PHG75W4.cjs → chunk-YTMFJLJZ.cjs} +7 -5
  28. package/dist/chunk-YTMFJLJZ.cjs.map +1 -0
  29. package/dist/{chunk-MU3MR2QR.cjs → chunk-YU6QFFI4.cjs} +5 -222
  30. package/dist/chunk-YU6QFFI4.cjs.map +1 -0
  31. package/dist/{chunk-CAP6QQR2.cjs → chunk-ZMSYKV62.cjs} +5 -5
  32. package/dist/{chunk-CAP6QQR2.cjs.map → chunk-ZMSYKV62.cjs.map} +1 -1
  33. package/dist/{chunk-NBDPIRQS.cjs → chunk-ZPMFT2JW.js} +4 -786
  34. package/dist/chunk-ZPMFT2JW.js.map +1 -0
  35. package/dist/{chunk-MXJJN4IA.js → chunk-ZUK55KZB.js} +7 -5
  36. package/dist/chunk-ZUK55KZB.js.map +1 -0
  37. package/dist/index.cjs +542 -145
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.js +389 -12
  40. package/dist/index.js.map +1 -1
  41. package/dist/middleware.cjs +33 -23
  42. package/dist/middleware.js +4 -2
  43. package/dist/migrations-IHERIQVD.js +4 -0
  44. package/dist/migrations-IHERIQVD.js.map +1 -0
  45. package/dist/migrations-POFD5KNG.cjs +13 -0
  46. package/dist/migrations-POFD5KNG.cjs.map +1 -0
  47. package/dist/routes.cjs +31 -29
  48. package/dist/routes.js +8 -6
  49. package/dist/services.cjs +44 -26
  50. package/dist/services.js +4 -2
  51. package/dist/templates.cjs +17 -21
  52. package/dist/templates.js +2 -2
  53. package/dist/utils.cjs +44 -11
  54. package/dist/utils.js +2 -1
  55. package/migrations/001_initial_schema.sql +2 -2
  56. package/migrations/007_demo_login_plugin.sql +1 -1
  57. package/migrations/020_add_email_plugin.sql +22 -0
  58. package/migrations/021_add_magic_link_auth_plugin.sql +42 -0
  59. package/migrations/021_add_otp_login.sql +42 -0
  60. package/migrations/022_add_tinymce_plugin.sql +25 -0
  61. package/migrations/023_add_easy_mdx_plugin.sql +25 -0
  62. package/migrations/024_add_quill_editor_plugin.sql +25 -0
  63. package/migrations/025_rename_mdxeditor_to_easy_mdx.sql +22 -0
  64. package/package.json +5 -3
  65. package/dist/chunk-3PHG75W4.cjs.map +0 -1
  66. package/dist/chunk-COBUPOMD.js.map +0 -1
  67. package/dist/chunk-HXA5QSI3.cjs.map +0 -1
  68. package/dist/chunk-LW33AOBF.js.map +0 -1
  69. package/dist/chunk-MU3MR2QR.cjs.map +0 -1
  70. package/dist/chunk-MXJJN4IA.js.map +0 -1
  71. package/dist/chunk-NBDPIRQS.cjs.map +0 -1
  72. package/dist/chunk-Q7SL7U43.cjs.map +0 -1
  73. package/dist/chunk-YHG45LMU.js.map +0 -1
  74. package/dist/chunk-Z4H6DBVF.js.map +0 -1
  75. package/migrations/002_faq_plugin.sql +0 -86
@@ -399,14 +399,14 @@ function renderAdminLayoutCatalyst(data) {
399
399
  }
400
400
 
401
401
  try {
402
- const response = await fetch('/api/migrations/status');
402
+ const response = await fetch('/admin/api/migrations/status');
403
403
  if (response.ok) {
404
404
  const data = await response.json();
405
- if (data.pendingMigrations > 0) {
405
+ if (data.success && data.data && data.data.pendingMigrations > 0) {
406
406
  const banner = document.getElementById('migration-banner');
407
407
  const countElement = document.getElementById('migration-count');
408
408
  if (banner && countElement) {
409
- countElement.textContent = data.pendingMigrations;
409
+ countElement.textContent = data.data.pendingMigrations;
410
410
  banner.classList.remove('hidden');
411
411
  }
412
412
  }
@@ -2945,222 +2945,6 @@ function renderCheckboxPage(data) {
2945
2945
  return renderAdminLayoutCatalyst(layoutData);
2946
2946
  }
2947
2947
 
2948
- // src/templates/pages/admin-faq-list.template.ts
2949
- init_admin_layout_catalyst_template();
2950
- function renderFAQList(data) {
2951
- const { faqs, totalCount, currentPage, totalPages, message, messageType } = data;
2952
- const pageContent = `
2953
- <div>
2954
- <!-- Header -->
2955
- <div class="flex flex-col sm:flex-row sm:items-center sm:justify-between mb-6">
2956
- <div>
2957
- <h1 class="text-2xl/8 font-semibold text-zinc-950 dark:text-white sm:text-xl/8">FAQ Management</h1>
2958
- <p class="mt-2 text-sm/6 text-zinc-500 dark:text-zinc-400">Manage frequently asked questions</p>
2959
- </div>
2960
- <div class="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">
2961
- <a href="/admin/faq/new"
2962
- 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">
2963
- <svg class="-ml-0.5 mr-1.5 h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
2964
- <path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" />
2965
- </svg>
2966
- Add FAQ
2967
- </a>
2968
- </div>
2969
- </div>
2970
-
2971
- ${message ? renderAlert({ type: messageType || "info", message, dismissible: true }) : ""}
2972
-
2973
- <!-- Filters -->
2974
- <div class="relative rounded-xl overflow-hidden mb-6">
2975
- <!-- Gradient Background -->
2976
- <div class="absolute inset-0 bg-gradient-to-r from-cyan-500/10 via-blue-500/10 to-purple-500/10 dark:from-cyan-400/20 dark:via-blue-400/20 dark:to-purple-400/20"></div>
2977
-
2978
- <div class="relative bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl shadow-sm ring-1 ring-zinc-950/5 dark:ring-white/10">
2979
- <div class="px-6 py-5">
2980
- <div class="flex items-center justify-between">
2981
- <div class="flex items-center space-x-4 flex-1">
2982
- <div>
2983
- <label for="category" class="block text-sm/6 font-medium text-zinc-950 dark:text-white">Category</label>
2984
- <div class="mt-2 grid grid-cols-1">
2985
- <select
2986
- name="category"
2987
- id="category"
2988
- hx-get="/admin/faq"
2989
- hx-trigger="change"
2990
- hx-target="#faq-list"
2991
- hx-include="[name='published'], [name='search']"
2992
- class="col-start-1 row-start-1 w-full appearance-none rounded-md bg-white/5 dark:bg-white/5 py-1.5 pl-3 pr-8 text-base text-zinc-950 dark:text-white outline outline-1 -outline-offset-1 outline-cyan-500/30 dark:outline-cyan-400/30 *:bg-white dark:*:bg-zinc-800 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-cyan-500 dark:focus-visible:outline-cyan-400 sm:text-sm/6 min-w-48"
2993
- >
2994
- <option value="">All Categories</option>
2995
- <option value="general">General</option>
2996
- <option value="technical">Technical</option>
2997
- <option value="billing">Billing</option>
2998
- <option value="support">Support</option>
2999
- </select>
3000
- <svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-cyan-600 dark:text-cyan-400 sm:size-4">
3001
- <path d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" fill-rule="evenodd" />
3002
- </svg>
3003
- </div>
3004
- </div>
3005
- <div>
3006
- <label for="published" class="block text-sm/6 font-medium text-zinc-950 dark:text-white">Status</label>
3007
- <div class="mt-2 grid grid-cols-1">
3008
- <select
3009
- name="published"
3010
- id="published"
3011
- hx-get="/admin/faq"
3012
- hx-trigger="change"
3013
- hx-target="#faq-list"
3014
- hx-include="[name='category'], [name='search']"
3015
- class="col-start-1 row-start-1 w-full appearance-none rounded-md bg-white/5 dark:bg-white/5 py-1.5 pl-3 pr-8 text-base text-zinc-950 dark:text-white outline outline-1 -outline-offset-1 outline-cyan-500/30 dark:outline-cyan-400/30 *:bg-white dark:*:bg-zinc-800 focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-cyan-500 dark:focus-visible:outline-cyan-400 sm:text-sm/6 min-w-48"
3016
- >
3017
- <option value="">All</option>
3018
- <option value="true">Published</option>
3019
- <option value="false">Draft</option>
3020
- </select>
3021
- <svg viewBox="0 0 16 16" fill="currentColor" data-slot="icon" aria-hidden="true" class="pointer-events-none col-start-1 row-start-1 mr-2 size-5 self-center justify-self-end text-cyan-600 dark:text-cyan-400 sm:size-4">
3022
- <path d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" fill-rule="evenodd" />
3023
- </svg>
3024
- </div>
3025
- </div>
3026
- <div class="flex-1 max-w-md">
3027
- <label for="search" class="block text-sm font-medium text-zinc-950 dark:text-white mb-2">Search</label>
3028
- <div class="relative group">
3029
- <div class="absolute left-3.5 top-2.5 flex items-center justify-center w-5 h-5 rounded-full bg-gradient-to-br from-cyan-400 to-blue-500 dark:from-cyan-300 dark:to-blue-400 opacity-90 group-focus-within:opacity-100 transition-opacity">
3030
- <svg class="h-3 w-3 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24" stroke-width="2.5">
3031
- <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
3032
- </svg>
3033
- </div>
3034
- <input
3035
- type="text"
3036
- name="search"
3037
- id="search"
3038
- placeholder="Search questions..."
3039
- hx-get="/admin/faq"
3040
- hx-trigger="keyup changed delay:300ms"
3041
- hx-target="#faq-list"
3042
- hx-include="[name='category'], [name='published']"
3043
- class="w-full rounded-full bg-transparent px-11 py-2 text-sm text-zinc-950 dark:text-white placeholder-zinc-500 dark:placeholder-zinc-400 border-2 border-cyan-200/50 dark:border-cyan-700/50 focus:outline-none focus:border-cyan-500 dark:focus:border-cyan-400 focus:shadow-lg focus:shadow-cyan-500/20 dark:focus:shadow-cyan-400/20 transition-all duration-300"
3044
- />
3045
- </div>
3046
- </div>
3047
- </div>
3048
- <div class="flex items-center gap-x-3 ml-4">
3049
- <span class="text-sm/6 font-medium text-zinc-700 dark:text-zinc-300 px-3 py-1.5 rounded-full bg-white/60 dark:bg-zinc-800/60 backdrop-blur-sm">${totalCount} ${totalCount === 1 ? "item" : "items"}</span>
3050
- <button
3051
- onclick="location.reload()"
3052
- class="inline-flex items-center gap-x-1.5 px-3 py-1.5 bg-white/90 dark:bg-zinc-800/90 backdrop-blur-sm text-zinc-950 dark:text-white text-sm font-medium rounded-full ring-1 ring-inset ring-cyan-200/50 dark:ring-cyan-700/50 hover:bg-gradient-to-r hover:from-cyan-50 hover:to-blue-50 dark:hover:from-cyan-900/30 dark:hover:to-blue-900/30 hover:ring-cyan-300 dark:hover:ring-cyan-600 transition-all duration-200"
3053
- >
3054
- <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
3055
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
3056
- </svg>
3057
- Refresh
3058
- </button>
3059
- </div>
3060
- </div>
3061
- </div>
3062
- </div>
3063
- </div>
3064
-
3065
- <!-- FAQ List -->
3066
- <div id="faq-list">
3067
- ${faqs.length > 0 ? renderTable({
3068
- tableId: "faq-table",
3069
- rowClickable: true,
3070
- rowClickUrl: (row) => `/admin/faq/${row.id}`,
3071
- columns: [
3072
- { key: "question", label: "Question", sortable: true, sortType: "string" },
3073
- { key: "category", label: "Category", sortable: true, sortType: "string" },
3074
- { key: "isPublished", label: "Status", sortable: true, sortType: "boolean" },
3075
- { key: "sortOrder", label: "Order", sortable: true, sortType: "number" },
3076
- { key: "created_at", label: "Created", sortable: true, sortType: "date" },
3077
- { key: "actions", label: "Actions", sortable: false }
3078
- ],
3079
- rows: faqs.map((faq) => ({
3080
- id: faq.id,
3081
- question: `
3082
- <div class="max-w-xs">
3083
- <div class="font-medium text-zinc-950 dark:text-white truncate">${escapeHtml(faq.question)}</div>
3084
- ${faq.tags ? `<div class="text-sm text-zinc-500 dark:text-zinc-400 mt-1">${escapeHtml(faq.tags)}</div>` : ""}
3085
- </div>
3086
- `,
3087
- category: faq.category ? `
3088
- <span class="inline-flex items-center rounded-md bg-purple-50 dark:bg-purple-500/10 px-2.5 py-1 text-sm font-medium text-purple-700 dark:text-purple-300 ring-1 ring-inset ring-purple-700/10 dark:ring-purple-400/20">
3089
- ${escapeHtml(faq.category)}
3090
- </span>
3091
- ` : '<span class="text-zinc-500 dark:text-zinc-400">\u2014</span>',
3092
- isPublished: faq.isPublished ? `
3093
- <span class="inline-flex items-center rounded-md bg-lime-50 dark:bg-lime-500/10 px-2.5 py-1 text-sm font-medium text-lime-700 dark:text-lime-300 ring-1 ring-inset ring-lime-700/10 dark:ring-lime-400/20">
3094
- Published
3095
- </span>
3096
- ` : `
3097
- <span class="inline-flex items-center rounded-md bg-yellow-50 dark:bg-yellow-500/10 px-2.5 py-1 text-sm font-medium text-yellow-700 dark:text-yellow-300 ring-1 ring-inset ring-yellow-700/10 dark:ring-yellow-400/20">
3098
- Draft
3099
- </span>
3100
- `,
3101
- sortOrder: faq.sortOrder.toString(),
3102
- created_at: new Date(faq.created_at * 1e3).toLocaleDateString(),
3103
- actions: `
3104
- <div class="flex space-x-2">
3105
- <button
3106
- class="inline-flex items-center justify-center p-1.5 rounded-lg bg-red-600 text-white hover:bg-red-700 transition-colors"
3107
- hx-delete="/admin/faq/${faq.id}"
3108
- hx-confirm="Are you sure you want to delete this FAQ?"
3109
- hx-target="#faq-list"
3110
- hx-swap="outerHTML"
3111
- title="Delete"
3112
- >
3113
- <svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
3114
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
3115
- </svg>
3116
- </button>
3117
- </div>
3118
- `
3119
- })),
3120
- selectable: true
3121
- }) : `
3122
- <div class="rounded-xl bg-white dark:bg-zinc-900 shadow-sm ring-1 ring-zinc-950/5 dark:ring-white/10 p-8 text-center">
3123
- <svg class="mx-auto h-12 w-12 text-zinc-400 dark:text-zinc-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
3124
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
3125
- </svg>
3126
- <h3 class="mt-2 text-sm font-medium text-zinc-950 dark:text-white">No FAQs</h3>
3127
- <p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Get started by creating your first FAQ.</p>
3128
- <div class="mt-6">
3129
- <a href="/admin/faq/new"
3130
- 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">
3131
- <svg class="-ml-1 mr-2 h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
3132
- <path d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z" />
3133
- </svg>
3134
- New FAQ
3135
- </a>
3136
- </div>
3137
- </div>
3138
- `}
3139
- </div>
3140
-
3141
- ${totalPages > 1 ? renderPagination({
3142
- currentPage,
3143
- totalPages,
3144
- totalItems: totalCount,
3145
- itemsPerPage: 20,
3146
- startItem: (currentPage - 1) * 20 + 1,
3147
- endItem: Math.min(currentPage * 20, totalCount),
3148
- baseUrl: "/admin/faq"
3149
- }) : ""}
3150
- </div>
3151
- `;
3152
- const layoutData = {
3153
- title: "FAQ Management - Admin",
3154
- currentPath: "/admin/faq",
3155
- user: data.user,
3156
- content: pageContent
3157
- };
3158
- return renderAdminLayoutCatalyst(layoutData);
3159
- }
3160
- function escapeHtml(unsafe) {
3161
- return unsafe.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
3162
- }
3163
-
3164
2948
  // src/templates/pages/admin-testimonials-list.template.ts
3165
2949
  init_admin_layout_catalyst_template();
3166
2950
  function renderTestimonialsList(data) {
@@ -3740,6 +3524,6 @@ function renderFormField(field) {
3740
3524
  `;
3741
3525
  }
3742
3526
 
3743
- export { adminLayoutV2, getConfirmationDialogScript, init_admin_layout_catalyst_template, init_logo_template, renderAdminLayout, renderAdminLayoutCatalyst, renderAlert, renderCheckboxPage, renderCodeExamplesList, renderConfirmationDialog, renderDesignPage, renderFAQList, renderForm, renderFormField, renderLogo, renderPagination, renderTable, renderTestimonialsList };
3744
- //# sourceMappingURL=chunk-LW33AOBF.js.map
3745
- //# sourceMappingURL=chunk-LW33AOBF.js.map
3527
+ export { adminLayoutV2, getConfirmationDialogScript, init_admin_layout_catalyst_template, init_logo_template, renderAdminLayout, renderAdminLayoutCatalyst, renderAlert, renderCheckboxPage, renderCodeExamplesList, renderConfirmationDialog, renderDesignPage, renderForm, renderFormField, renderLogo, renderPagination, renderTable, renderTestimonialsList };
3528
+ //# sourceMappingURL=chunk-5RKQB2JG.js.map
3529
+ //# sourceMappingURL=chunk-5RKQB2JG.js.map