create-nextblock 0.10.6 → 0.10.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -22,11 +22,34 @@ export type OnboardingStatus = {
22
22
  dismissed: boolean;
23
23
  };
24
24
 
25
- function hasCopyright(value: unknown): boolean {
25
+ // Seeded defaults (libs/db migrations 008 + 010). The branding/copyright steps count as
26
+ // "done" only when the value has been customized away from these — a fresh install ships
27
+ // with the seeds, so a plain presence check would mark every step complete immediately.
28
+ const SEEDED_SITE_TITLE = 'NextBlock™ CMS';
29
+ const SEEDED_LOGO_OBJECT_KEY = 'images/nextblock-logo-small.webp';
30
+ const SEEDED_COPYRIGHT: Record<string, string> = {
31
+ en: '© {year} Nextblock CMS. All rights reserved.',
32
+ fr: '© {year} Nextblock CMS. Tous droits réservés.',
33
+ };
34
+
35
+ /** True when at least one language's copyright text is set AND differs from the seed. */
36
+ function hasCustomCopyright(value: unknown): boolean {
26
37
  if (!value || typeof value !== 'object') return false;
27
- return Object.values(value as Record<string, unknown>).some(
28
- (v) => typeof v === 'string' && v.trim().length > 0
29
- );
38
+ return Object.entries(value as Record<string, unknown>).some(([lang, v]) => {
39
+ if (typeof v !== 'string') return false;
40
+ const trimmed = v.trim();
41
+ return trimmed.length > 0 && trimmed !== (SEEDED_COPYRIGHT[lang] ?? '');
42
+ });
43
+ }
44
+
45
+ /** Pull the active logo's media object_key from the (to-one) embedded relation. */
46
+ function extractLogoObjectKey(logoRow: unknown): string | null {
47
+ if (!logoRow || typeof logoRow !== 'object') return null;
48
+ const media = (logoRow as { media?: unknown }).media;
49
+ const record = Array.isArray(media) ? media[0] : media;
50
+ if (!record || typeof record !== 'object') return null;
51
+ const key = (record as { object_key?: unknown }).object_key;
52
+ return typeof key === 'string' ? key : null;
30
53
  }
31
54
 
32
55
  export async function getOnboardingStatus(opts: {
@@ -38,8 +61,13 @@ export async function getOnboardingStatus(opts: {
38
61
  supabase
39
62
  .from('site_settings')
40
63
  .select('key, value')
41
- .in('key', ['footer_copyright', 'bot_protection_public', 'onboarding_state']),
42
- supabase.from('logos').select('id').limit(1).maybeSingle(),
64
+ .in('key', ['footer_copyright', 'bot_protection_public', 'onboarding_state', 'site_title']),
65
+ supabase
66
+ .from('logos')
67
+ .select('media:media_id(object_key)')
68
+ .order('created_at', { ascending: false })
69
+ .limit(1)
70
+ .maybeSingle(),
43
71
  getEmailPublicSettings(),
44
72
  getPrivacySettings(),
45
73
  ]);
@@ -48,8 +76,16 @@ export async function getOnboardingStatus(opts: {
48
76
  const botPublic = (rows.get('bot_protection_public') ?? {}) as Record<string, unknown>;
49
77
  const onboardingState = (rows.get('onboarding_state') ?? {}) as Record<string, unknown>;
50
78
 
51
- const brandingDone = Boolean(logoRow);
52
- const copyrightDone = hasCopyright(rows.get('footer_copyright'));
79
+ const siteTitleRaw = rows.get('site_title');
80
+ const siteTitle = typeof siteTitleRaw === 'string' ? siteTitleRaw.trim() : '';
81
+ const siteTitleCustomized = siteTitle.length > 0 && siteTitle !== SEEDED_SITE_TITLE;
82
+ const logoObjectKey = extractLogoObjectKey(logoRow);
83
+ const logoCustomized = Boolean(logoObjectKey) && logoObjectKey !== SEEDED_LOGO_OBJECT_KEY;
84
+
85
+ // Branding is "done" once the user renames the site or uploads their own logo — not merely
86
+ // because the seeded NextBlock title/logo exist.
87
+ const brandingDone = siteTitleCustomized || logoCustomized;
88
+ const copyrightDone = hasCustomCopyright(rows.get('footer_copyright'));
53
89
  const emailDone = Boolean(emailPublic.host) || Boolean(process.env['SMTP_HOST']);
54
90
  const analyticsDone = Boolean(privacy.gtm_id);
55
91
  const botProvider = typeof botPublic['provider'] === 'string' ? (botPublic['provider'] as string) : 'none';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/template",
3
- "version": "0.10.6",
3
+ "version": "0.10.7",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",