@c15t/cli 2.0.0-rc.6 → 2.0.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/README.md +8 -8
- package/dist/145.mjs +1223 -332
- package/dist/generate-files.mjs +64 -90
- package/dist-types/auth/base-url.d.ts +2 -2
- package/dist-types/auth/config-store.d.ts +2 -2
- package/dist-types/auth/types.d.ts +1 -1
- package/dist-types/commands/generate/prompts/mode-select.d.ts +1 -1
- package/dist-types/commands/generate/templates/css.d.ts +10 -11
- package/dist-types/commands/generate/templates/shared/components.d.ts +1 -1
- package/dist-types/commands/generate/templates/shared/framework-config.d.ts +0 -4
- package/dist-types/commands/index.d.ts +1 -1
- package/dist-types/commands/instances/index.d.ts +13 -8
- package/dist-types/commands/self-host/migrate/migrator-result.d.ts +1 -1
- package/dist-types/commands/self-host/migrate/orm-result.d.ts +1 -1
- package/dist-types/commands/self-host/migrate/read-config.d.ts +1 -1
- package/dist-types/commands/shared/stylesheets.d.ts +19 -0
- package/dist-types/constants.d.ts +19 -7
- package/dist-types/context/types.d.ts +3 -1
- package/dist-types/control-plane/client.d.ts +6 -6
- package/dist-types/control-plane/types.d.ts +5 -5
- package/dist-types/core/errors.d.ts +10 -10
- package/dist-types/core/telemetry.d.ts +2 -77
- package/dist-types/machines/generate/actors/prompts.d.ts +1 -1
- package/dist-types/machines/generate/machine.d.ts +7 -7
- package/dist-types/machines/generate/types.d.ts +2 -2
- package/dist-types/types.d.ts +8 -18
- package/dist-types/utils/logger.d.ts +7 -6
- package/dist-types/utils/telemetry.d.ts +61 -117
- package/dist-types/utils/validation.d.ts +2 -2
- package/package.json +9 -9
- package/readme.json +2 -2
package/dist/generate-files.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import promises from "node:fs/promises";
|
|
|
2
2
|
import node_path from "node:path";
|
|
3
3
|
import picocolors from "picocolors";
|
|
4
4
|
import { Node, Project, SyntaxKind } from "ts-morph";
|
|
5
|
-
import {
|
|
5
|
+
import { formatSearchedCssPaths, ensureGlobalCssStylesheetImports, STORAGE_MODES, LAYOUT_PATTERNS, logger_formatLogMessage, PAGES_APP_PATTERNS as constants_PAGES_APP_PATTERNS, constants_REGEX } from "./145.mjs";
|
|
6
6
|
function generateClientConfigContent(mode, backendURL, useEnvFile, enableDevTools = false) {
|
|
7
7
|
switch(mode){
|
|
8
8
|
case STORAGE_MODES.HOSTED:
|
|
@@ -19,7 +19,7 @@ function generateClientConfigContent(mode, backendURL, useEnvFile, enableDevTool
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
function generateHostedConfig(backendURL, useEnvFile, enableDevTools = false) {
|
|
22
|
-
const url = useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL' : `'${backendURL || 'https://your-
|
|
22
|
+
const url = useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL' : `'${backendURL || 'https://your-project.inth.app'}'`;
|
|
23
23
|
const devToolsImport = enableDevTools ? "import { createDevTools } from '@c15t/dev-tools';\n" : '';
|
|
24
24
|
const devToolsCall = enableDevTools ? 'createDevTools();\n' : '';
|
|
25
25
|
return `import { getOrCreateConsentRuntime } from 'c15t';
|
|
@@ -165,51 +165,16 @@ ${devToolsCall}
|
|
|
165
165
|
// store.getState().saveConsents("necessary")
|
|
166
166
|
`;
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
'src/App.css'
|
|
179
|
-
];
|
|
180
|
-
async function updateTailwindCss(projectRoot, tailwindVersion) {
|
|
181
|
-
if (!tailwindVersion || !tailwindVersion.match(/^(?:\^|~)?3/)) return {
|
|
182
|
-
updated: false,
|
|
183
|
-
filePath: null
|
|
184
|
-
};
|
|
185
|
-
for (const pattern of CSS_PATTERNS){
|
|
186
|
-
const filePath = node_path.join(projectRoot, pattern);
|
|
187
|
-
try {
|
|
188
|
-
await promises.access(filePath);
|
|
189
|
-
const content = await promises.readFile(filePath, 'utf-8');
|
|
190
|
-
if (content.includes('@layer base, components, c15t;') || content.includes('@layer base, components;')) return {
|
|
191
|
-
updated: false,
|
|
192
|
-
filePath
|
|
193
|
-
};
|
|
194
|
-
if (content.includes('@tailwind base') || content.includes('@tailwind components') || content.includes('@tailwind utilities')) {
|
|
195
|
-
let newContent = content;
|
|
196
|
-
if (newContent.includes('@tailwind base')) {
|
|
197
|
-
newContent = newContent.replace('@tailwind base;', '@layer base {\n @tailwind base;\n}');
|
|
198
|
-
newContent = newContent.replace('@tailwind base\n', '@layer base {\n @tailwind base;\n}\n');
|
|
199
|
-
}
|
|
200
|
-
if (!newContent.includes('@layer base, components, c15t;')) newContent = `@layer base, components, c15t;\n\n${newContent}`;
|
|
201
|
-
await promises.writeFile(filePath, newContent, 'utf-8');
|
|
202
|
-
return {
|
|
203
|
-
updated: true,
|
|
204
|
-
filePath
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
} catch {}
|
|
208
|
-
}
|
|
209
|
-
return {
|
|
210
|
-
updated: false,
|
|
211
|
-
filePath: null
|
|
212
|
-
};
|
|
168
|
+
async function updateAppStylesheetImports(options) {
|
|
169
|
+
return ensureGlobalCssStylesheetImports({
|
|
170
|
+
projectRoot: options.projectRoot,
|
|
171
|
+
packageName: options.packageName,
|
|
172
|
+
tailwindVersion: options.tailwindVersion,
|
|
173
|
+
entrypointPath: options.entrypointPath,
|
|
174
|
+
includeBase: true,
|
|
175
|
+
includeIab: options.includeIab ?? false,
|
|
176
|
+
dryRun: options.dryRun
|
|
177
|
+
});
|
|
213
178
|
}
|
|
214
179
|
function getEnvVarName(pkg) {
|
|
215
180
|
return '@c15t/nextjs' === pkg ? 'NEXT_PUBLIC_C15T_URL' : 'PUBLIC_C15T_URL';
|
|
@@ -220,7 +185,7 @@ function generateEnvFileContent(backendURL, pkg) {
|
|
|
220
185
|
}
|
|
221
186
|
function generateEnvExampleContent(pkg) {
|
|
222
187
|
const envVarName = getEnvVarName(pkg);
|
|
223
|
-
return `\n# c15t Configuration\n${envVarName}=https://your-
|
|
188
|
+
return `\n# c15t Configuration\n${envVarName}=https://your-project.inth.app\n`;
|
|
224
189
|
}
|
|
225
190
|
async function findMatchingFiles(projectRoot, patterns, logger) {
|
|
226
191
|
const matches = [];
|
|
@@ -369,7 +334,7 @@ function generateConsentComponent({ importSource, optionsText, selectedScripts =
|
|
|
369
334
|
const scriptsConfig = selectedScripts.length ? generateScriptsConfig(selectedScripts) : generateScriptsCommentPlaceholder();
|
|
370
335
|
const ssrDataLine = ssrDataOption ? '\n\t\t\t\tssrData,' : '';
|
|
371
336
|
const themeLine = includeTheme ? '\n\t\t\t\ttheme,' : '';
|
|
372
|
-
const overridesLine =
|
|
337
|
+
const overridesLine = '';
|
|
373
338
|
const fullOptionsText = `{
|
|
374
339
|
${optionsText}${ssrDataLine}${themeLine}
|
|
375
340
|
${scriptsConfig}${overridesLine}
|
|
@@ -384,7 +349,7 @@ function generateConsentComponent({ importSource, optionsText, selectedScripts =
|
|
|
384
349
|
ConsentBanner,`;
|
|
385
350
|
const frameworkPropsImport = useConsentManagerProps ? `import type { ConsentManagerProps } from '${useFrameworkProps}';\n` : '';
|
|
386
351
|
let propsDestructure;
|
|
387
|
-
propsDestructure = useConsentManagerProps ?
|
|
352
|
+
propsDestructure = useConsentManagerProps ? '{ children, ssrData }: ConsentManagerProps' : ssrDataOption ? `{
|
|
388
353
|
children,
|
|
389
354
|
ssrData,
|
|
390
355
|
}: {
|
|
@@ -435,17 +400,17 @@ function buildDocComment({ defaultExport, initialDataProp, ssrDataOption, docsSl
|
|
|
435
400
|
const slug = docsSlug || 'nextjs';
|
|
436
401
|
return `/**
|
|
437
402
|
* Client-side consent manager provider.
|
|
438
|
-
* @see https://
|
|
403
|
+
* @see https://c15t.com/docs/frameworks/${slug}/quickstart
|
|
439
404
|
*/`;
|
|
440
405
|
}
|
|
441
406
|
if (initialDataProp) return `/**
|
|
442
407
|
* Consent management wrapper for Next.js Pages Router.
|
|
443
|
-
* @see https://
|
|
408
|
+
* @see https://c15t.com/docs/frameworks/nextjs/quickstart
|
|
444
409
|
*/`;
|
|
445
410
|
const slug = docsSlug || 'react';
|
|
446
411
|
return `/**
|
|
447
412
|
* Consent manager provider.
|
|
448
|
-
* @see https://
|
|
413
|
+
* @see https://c15t.com/docs/frameworks/${slug}/quickstart
|
|
449
414
|
*/`;
|
|
450
415
|
}
|
|
451
416
|
async function directory_getComponentsDirectory(projectRoot, sourceDir) {
|
|
@@ -512,7 +477,7 @@ import { theme } from './theme';
|
|
|
512
477
|
${propsInterface}
|
|
513
478
|
/**
|
|
514
479
|
* Client-side consent manager provider with compound components.
|
|
515
|
-
* @see https://
|
|
480
|
+
* @see https://c15t.com/docs/frameworks/${framework.docsSlug}/quickstart
|
|
516
481
|
*/
|
|
517
482
|
export default function ConsentManagerClient(${propsDestructure}) {
|
|
518
483
|
return (
|
|
@@ -538,14 +503,16 @@ export default function ConsentManagerClient(${propsDestructure}) {
|
|
|
538
503
|
function generateExpandedConsentDialogTemplate(framework) {
|
|
539
504
|
return `'use client';
|
|
540
505
|
|
|
541
|
-
import {
|
|
542
|
-
import { ConsentDialog } from '${framework.consentDialogImport}';
|
|
506
|
+
import { useState } from 'react';
|
|
507
|
+
import { ConsentDialog, ConsentWidget } from '${framework.consentDialogImport}';
|
|
543
508
|
|
|
544
509
|
/**
|
|
545
510
|
* Consent dialog using compound components.
|
|
546
|
-
* @see https://
|
|
511
|
+
* @see https://c15t.com/docs/frameworks/${framework.docsSlug}/components/consent-dialog
|
|
547
512
|
*/
|
|
548
513
|
export default function () {
|
|
514
|
+
const [openItem, setOpenItem] = useState('');
|
|
515
|
+
|
|
549
516
|
return (
|
|
550
517
|
<ConsentDialog.Root>
|
|
551
518
|
<ConsentDialog.Card>
|
|
@@ -554,7 +521,19 @@ export default function () {
|
|
|
554
521
|
<ConsentDialog.HeaderDescription />
|
|
555
522
|
</ConsentDialog.Header>
|
|
556
523
|
<ConsentDialog.Content>
|
|
557
|
-
<ConsentWidget
|
|
524
|
+
<ConsentWidget.Root>
|
|
525
|
+
<ConsentWidget.Accordion
|
|
526
|
+
type="single"
|
|
527
|
+
value={openItem}
|
|
528
|
+
onValueChange={(value) => {
|
|
529
|
+
setOpenItem(Array.isArray(value) ? (value[0] ?? '') : (value ?? ''));
|
|
530
|
+
}}
|
|
531
|
+
>
|
|
532
|
+
<ConsentWidget.AccordionItems />
|
|
533
|
+
</ConsentWidget.Accordion>
|
|
534
|
+
{/* Pass renderAction to customize mapping. Stock c15t buttons render by default. */}
|
|
535
|
+
<ConsentWidget.PolicyActions />
|
|
536
|
+
</ConsentWidget.Root>
|
|
558
537
|
</ConsentDialog.Content>
|
|
559
538
|
<ConsentDialog.Footer />
|
|
560
539
|
</ConsentDialog.Card>
|
|
@@ -570,7 +549,7 @@ import { ConsentBanner } from '${framework.consentBannerImport}';
|
|
|
570
549
|
|
|
571
550
|
/**
|
|
572
551
|
* Consent banner using compound components.
|
|
573
|
-
* @see https://
|
|
552
|
+
* @see https://c15t.com/docs/frameworks/${framework.docsSlug}/components/consent-banner
|
|
574
553
|
*/
|
|
575
554
|
export default function () {
|
|
576
555
|
return (
|
|
@@ -582,13 +561,8 @@ export default function () {
|
|
|
582
561
|
legalLinks={['privacyPolicy', 'termsOfService']}
|
|
583
562
|
/>
|
|
584
563
|
</ConsentBanner.Header>
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
<ConsentBanner.RejectButton />
|
|
588
|
-
<ConsentBanner.AcceptButton />
|
|
589
|
-
</ConsentBanner.FooterSubGroup>
|
|
590
|
-
<ConsentBanner.CustomizeButton />
|
|
591
|
-
</ConsentBanner.Footer>
|
|
564
|
+
{/* Pass renderAction to customize mapping. Stock c15t buttons render by default. */}
|
|
565
|
+
<ConsentBanner.PolicyActions />
|
|
592
566
|
</ConsentBanner.Card>
|
|
593
567
|
</ConsentBanner.Root>
|
|
594
568
|
);
|
|
@@ -618,7 +592,7 @@ function generateTailwindTheme(framework) {
|
|
|
618
592
|
*
|
|
619
593
|
* Customize the colors, typography, and slots below to match your design.
|
|
620
594
|
*
|
|
621
|
-
* @see https://
|
|
595
|
+
* @see https://c15t.com/docs/customization/theming
|
|
622
596
|
*/
|
|
623
597
|
export const theme: Theme = {
|
|
624
598
|
colors: {
|
|
@@ -670,7 +644,7 @@ function generateMinimalTheme(framework) {
|
|
|
670
644
|
*
|
|
671
645
|
* Customize the colors, typography, and slots below to match your design.
|
|
672
646
|
*
|
|
673
|
-
* @see https://
|
|
647
|
+
* @see https://c15t.com/docs/customization/theming
|
|
674
648
|
*/
|
|
675
649
|
export const theme: Theme = {
|
|
676
650
|
colors: {
|
|
@@ -773,7 +747,7 @@ function generateDarkTheme(framework) {
|
|
|
773
747
|
*
|
|
774
748
|
* Customize the colors, typography, and slots below to match your design.
|
|
775
749
|
*
|
|
776
|
-
* @see https://
|
|
750
|
+
* @see https://c15t.com/docs/customization/theming
|
|
777
751
|
*/
|
|
778
752
|
export const theme: Theme = {
|
|
779
753
|
colors: {
|
|
@@ -861,9 +835,7 @@ const NEXTJS_CONFIG = {
|
|
|
861
835
|
ssrMechanism: 'Next.js headers() API',
|
|
862
836
|
docsSlug: 'nextjs',
|
|
863
837
|
envVarPrefix: 'NEXT_PUBLIC',
|
|
864
|
-
hasSSRProps: true
|
|
865
|
-
stylesheetImport: '@c15t/nextjs/styles.css',
|
|
866
|
-
iabStylesheetImport: '@c15t/nextjs/iab/styles.css'
|
|
838
|
+
hasSSRProps: true
|
|
867
839
|
};
|
|
868
840
|
const REACT_CONFIG = {
|
|
869
841
|
importSource: '@c15t/react',
|
|
@@ -873,9 +845,7 @@ const REACT_CONFIG = {
|
|
|
873
845
|
ssrMechanism: '',
|
|
874
846
|
docsSlug: 'react',
|
|
875
847
|
envVarPrefix: '',
|
|
876
|
-
hasSSRProps: false
|
|
877
|
-
stylesheetImport: '@c15t/react/styles.css',
|
|
878
|
-
iabStylesheetImport: '@c15t/react/iab/styles.css'
|
|
848
|
+
hasSSRProps: false
|
|
879
849
|
};
|
|
880
850
|
function computeRelativeModuleSpecifier(fromFilePath, toFilePath) {
|
|
881
851
|
const fromDir = node_path.dirname(fromFilePath);
|
|
@@ -958,7 +928,7 @@ async function runLayoutUpdatePipeline(config) {
|
|
|
958
928
|
function getBackendURLValue(backendURL, useEnvFile, proxyNextjs, envVarPrefix = 'NEXT_PUBLIC') {
|
|
959
929
|
if (proxyNextjs) return '"/api/c15t"';
|
|
960
930
|
if (useEnvFile) return `process.env.${envVarPrefix}_C15T_URL!`;
|
|
961
|
-
return `'${backendURL || 'https://your-
|
|
931
|
+
return `'${backendURL || 'https://your-project.inth.app'}'`;
|
|
962
932
|
}
|
|
963
933
|
function generateOptionsText(mode, backendURL, useEnvFile, proxyNextjs, inlineCustomHandlers, envVarPrefix = 'NEXT_PUBLIC') {
|
|
964
934
|
switch(mode){
|
|
@@ -1002,13 +972,11 @@ import ConsentManagerProvider from './provider';
|
|
|
1002
972
|
|
|
1003
973
|
/**
|
|
1004
974
|
* Server-side consent management wrapper with SSR data prefetching.
|
|
1005
|
-
* @see https://
|
|
975
|
+
* @see https://c15t.com/docs/frameworks/${framework.docsSlug}/quickstart
|
|
1006
976
|
*/
|
|
1007
977
|
export function ConsentManager({ children }: { children: ReactNode }) {
|
|
1008
978
|
const ssrData = fetchInitialData({
|
|
1009
979
|
backendURL: ${backendURLValue},
|
|
1010
|
-
// Shows banner during development. Remove for production.
|
|
1011
|
-
overrides: { country: 'DE' },
|
|
1012
980
|
});
|
|
1013
981
|
|
|
1014
982
|
return (
|
|
@@ -1023,7 +991,7 @@ import ConsentManagerProvider from './provider';
|
|
|
1023
991
|
|
|
1024
992
|
/**
|
|
1025
993
|
* Consent management wrapper.
|
|
1026
|
-
* @see https://
|
|
994
|
+
* @see https://c15t.com/docs/frameworks/${framework.docsSlug}/quickstart
|
|
1027
995
|
*/
|
|
1028
996
|
export function ConsentManager({ children }: { children: ReactNode }) {
|
|
1029
997
|
return (
|
|
@@ -1040,7 +1008,7 @@ import ConsentManagerProvider from './provider';
|
|
|
1040
1008
|
|
|
1041
1009
|
/**
|
|
1042
1010
|
* Consent management wrapper.
|
|
1043
|
-
* @see https://
|
|
1011
|
+
* @see https://c15t.com/docs/frameworks/${docsSlug}/quickstart
|
|
1044
1012
|
*/
|
|
1045
1013
|
export function ConsentManager({ children }: { children: ReactNode }) {
|
|
1046
1014
|
return <ConsentManagerProvider>{children}</ConsentManagerProvider>;
|
|
@@ -1234,7 +1202,7 @@ async function createConsentManagerComponent(projectRoot, pagesDir, optionsText,
|
|
|
1234
1202
|
function addServerSideDataComment(appFile, backendURL, useEnvFile, proxyNextjs) {
|
|
1235
1203
|
const existingComments = appFile.getLeadingCommentRanges();
|
|
1236
1204
|
let urlExample;
|
|
1237
|
-
urlExample = proxyNextjs ? "'/api/c15t'" : useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL!' : `'${backendURL || 'https://your-
|
|
1205
|
+
urlExample = proxyNextjs ? "'/api/c15t'" : useEnvFile ? 'process.env.NEXT_PUBLIC_C15T_URL!' : `'${backendURL || 'https://your-project.inth.app'}'`;
|
|
1238
1206
|
const serverSideComment = `/**
|
|
1239
1207
|
* Note: To get the initial server-side data on other pages, add this to each page:
|
|
1240
1208
|
*
|
|
@@ -1497,7 +1465,7 @@ function generateRewriteDestination(backendURL, useEnvFile) {
|
|
|
1497
1465
|
isTemplateLiteral: true
|
|
1498
1466
|
};
|
|
1499
1467
|
return {
|
|
1500
|
-
destination: `${backendURL || 'https://your-
|
|
1468
|
+
destination: `${backendURL || 'https://your-project.inth.app'}/:path*`,
|
|
1501
1469
|
isTemplateLiteral: false
|
|
1502
1470
|
};
|
|
1503
1471
|
}
|
|
@@ -1783,14 +1751,20 @@ async function generateFiles({ context, mode, spinner, useEnvFile, proxyNextjs,
|
|
|
1783
1751
|
spinner,
|
|
1784
1752
|
cwd: context.cwd
|
|
1785
1753
|
});
|
|
1786
|
-
if (
|
|
1787
|
-
spinner.start('
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1754
|
+
if ('@c15t/react' === pkg || '@c15t/nextjs' === pkg) {
|
|
1755
|
+
spinner.start('Configuring app stylesheet...');
|
|
1756
|
+
const stylesheetResult = await updateAppStylesheetImports({
|
|
1757
|
+
projectRoot,
|
|
1758
|
+
packageName: pkg,
|
|
1759
|
+
tailwindVersion: context.framework.tailwindVersion,
|
|
1760
|
+
entrypointPath: result.layoutPath
|
|
1761
|
+
});
|
|
1762
|
+
if (stylesheetResult.updated) {
|
|
1790
1763
|
result.tailwindCssUpdated = true;
|
|
1791
|
-
result.tailwindCssPath =
|
|
1792
|
-
spinner.stop(logger_formatLogMessage('info', `
|
|
1793
|
-
} else spinner.stop(logger_formatLogMessage('debug', '
|
|
1764
|
+
result.tailwindCssPath = stylesheetResult.filePath;
|
|
1765
|
+
spinner.stop(logger_formatLogMessage('info', `App stylesheet updated: ${picocolors.cyan(node_path.relative(context.cwd, stylesheetResult.filePath || ''))}`));
|
|
1766
|
+
} else if (stylesheetResult.filePath) spinner.stop(logger_formatLogMessage('debug', 'App stylesheet already had the correct c15t imports.'));
|
|
1767
|
+
else spinner.stop(logger_formatLogMessage('warn', `Could not find a global CSS entrypoint. Checked: ${formatSearchedCssPaths(projectRoot, stylesheetResult.searchedPaths)}`));
|
|
1794
1768
|
}
|
|
1795
1769
|
return result;
|
|
1796
1770
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolve the control-plane base URL for auth +
|
|
2
|
+
* Resolve the control-plane base URL for auth + hosted project management.
|
|
3
3
|
*
|
|
4
|
-
* Default:
|
|
4
|
+
* Default: inth.com
|
|
5
5
|
* Override: CONSENT_URL
|
|
6
6
|
*/
|
|
7
7
|
export declare function getControlPlaneBaseUrl(): string;
|
|
@@ -45,11 +45,11 @@ export declare function isLoggedIn(): Promise<boolean>;
|
|
|
45
45
|
*/
|
|
46
46
|
export declare function getAccessToken(): Promise<string | null>;
|
|
47
47
|
/**
|
|
48
|
-
* Get the selected
|
|
48
|
+
* Get the selected project ID
|
|
49
49
|
*/
|
|
50
50
|
export declare function getSelectedInstanceId(): Promise<string | null>;
|
|
51
51
|
/**
|
|
52
|
-
* Set the selected
|
|
52
|
+
* Set the selected project ID
|
|
53
53
|
*/
|
|
54
54
|
export declare function setSelectedInstanceId(instanceId: string): Promise<void>;
|
|
55
55
|
/**
|
|
@@ -11,7 +11,7 @@ export interface C15tConfig {
|
|
|
11
11
|
refreshToken?: string;
|
|
12
12
|
/** Token expiration timestamp (unix ms) */
|
|
13
13
|
expiresAt?: number;
|
|
14
|
-
/** Currently selected
|
|
14
|
+
/** Currently selected project ID */
|
|
15
15
|
selectedInstanceId?: string;
|
|
16
16
|
/** Last login timestamp */
|
|
17
17
|
lastLogin?: number;
|
|
@@ -9,7 +9,7 @@ import { type StorageMode } from '../../../constants';
|
|
|
9
9
|
export declare const MODE_OPTIONS: readonly [{
|
|
10
10
|
readonly value: "hosted";
|
|
11
11
|
readonly label: "Cloud Hosted";
|
|
12
|
-
readonly hint: "Managed by
|
|
12
|
+
readonly hint: "Managed by inth.com (Recommended)";
|
|
13
13
|
readonly description: "Store consent data securely in the cloud with zero infrastructure";
|
|
14
14
|
}, {
|
|
15
15
|
readonly value: "offline";
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}>;
|
|
1
|
+
import { type EnsureGlobalCssStylesheetImportsResult, type StyledPackageName } from '../../shared/stylesheets';
|
|
2
|
+
export interface UpdateAppStylesheetImportsOptions {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
packageName: Exclude<StyledPackageName, '@c15t/ui'>;
|
|
5
|
+
tailwindVersion: string | null;
|
|
6
|
+
entrypointPath?: string | null;
|
|
7
|
+
dryRun?: boolean;
|
|
8
|
+
includeIab?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function updateAppStylesheetImports(options: UpdateAppStylesheetImportsOptions): Promise<EnsureGlobalCssStylesheetImportsResult>;
|
|
@@ -17,7 +17,7 @@ interface GenerateConsentComponentOptions {
|
|
|
17
17
|
defaultExport?: boolean;
|
|
18
18
|
/** Whether to add ssrData prop passed inside options object (App Dir client with SSR) */
|
|
19
19
|
ssrDataOption?: boolean;
|
|
20
|
-
/** Whether to add geo override for development
|
|
20
|
+
/** Whether to add geo override for development */
|
|
21
21
|
includeOverrides?: boolean;
|
|
22
22
|
/** Whether to add c15t DevTools component */
|
|
23
23
|
enableDevTools?: boolean;
|
|
@@ -12,10 +12,6 @@ export interface FrameworkConfig {
|
|
|
12
12
|
docsSlug: string;
|
|
13
13
|
envVarPrefix: string;
|
|
14
14
|
hasSSRProps: boolean;
|
|
15
|
-
/** CSS stylesheet import path for prebuilt (styled) components, or null for unstyled. */
|
|
16
|
-
stylesheetImport: string | null;
|
|
17
|
-
/** CSS stylesheet import path for IAB components, or null if IAB is not applicable. */
|
|
18
|
-
iabStylesheetImport: string | null;
|
|
19
15
|
}
|
|
20
16
|
export declare const NEXTJS_CONFIG: FrameworkConfig;
|
|
21
17
|
export declare const REACT_CONFIG: FrameworkConfig;
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
export { authCommands, loginCommand, logoutCommand } from './auth';
|
|
5
5
|
export { codemodsCommand, runCodemods } from './codemods';
|
|
6
6
|
export { generate, generateCommand } from './generate';
|
|
7
|
-
export {
|
|
7
|
+
export { instancesAliasCommand, projectsCommand } from './instances';
|
|
8
8
|
export { selfHost } from './self-host';
|
|
9
9
|
export { installSkills } from './skills';
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Project management commands
|
|
3
3
|
*/
|
|
4
|
-
import type { CliCommand, CliContext } from '../../types';
|
|
4
|
+
import type { CliCommand, CliContext } from '../../context/types';
|
|
5
5
|
/**
|
|
6
|
-
* List
|
|
6
|
+
* List projects command
|
|
7
7
|
*/
|
|
8
8
|
declare function listAction(context: CliContext): Promise<void>;
|
|
9
9
|
/**
|
|
10
|
-
* Select
|
|
10
|
+
* Select project command
|
|
11
11
|
*/
|
|
12
12
|
declare function selectAction(context: CliContext): Promise<void>;
|
|
13
13
|
/**
|
|
14
|
-
* Create
|
|
14
|
+
* Create project command
|
|
15
15
|
*/
|
|
16
16
|
declare function createAction(context: CliContext): Promise<void>;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Main projects command (defaults to list)
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
declare function projectsAction(context: CliContext): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Projects command definition
|
|
23
|
+
*/
|
|
24
|
+
export declare const projectsCommand: CliCommand;
|
|
25
|
+
export declare const instancesAliasCommand: CliCommand;
|
|
26
|
+
export { createAction, listAction, projectsAction, selectAction };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { MigrationResult } from '
|
|
1
|
+
import type { MigrationResult } from '@c15t/backend/db/migrator';
|
|
2
2
|
import type { CliContext } from '../../../context/types';
|
|
3
3
|
export declare function handleMigrationResult(context: CliContext, result: MigrationResult): Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { ORMResult } from '
|
|
1
|
+
import type { ORMResult } from '@c15t/backend/db/migrator';
|
|
2
2
|
import type { CliContext } from '../../../context/types';
|
|
3
3
|
export declare function handleORMResult(context: CliContext, result: ORMResult): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DB } from '
|
|
1
|
+
import { DB } from '@c15t/backend/db/schema';
|
|
2
2
|
import type { CliContext } from '../../../context/types';
|
|
3
3
|
export declare function readConfigAndGetDb(context: CliContext, absoluteConfigPath: string): Promise<{
|
|
4
4
|
db: ReturnType<typeof DB.client>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type StyledPackageName = '@c15t/react' | '@c15t/nextjs' | '@c15t/ui';
|
|
2
|
+
export interface EnsureGlobalCssStylesheetImportsOptions {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
packageName: StyledPackageName;
|
|
5
|
+
tailwindVersion: string | null;
|
|
6
|
+
entrypointPath?: string | null;
|
|
7
|
+
includeBase: boolean;
|
|
8
|
+
includeIab: boolean;
|
|
9
|
+
dryRun?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface EnsureGlobalCssStylesheetImportsResult {
|
|
12
|
+
updated: boolean;
|
|
13
|
+
filePath: string | null;
|
|
14
|
+
searchedPaths: string[];
|
|
15
|
+
changes: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare function formatSearchedCssPaths(projectRoot: string, searchedPaths: string[]): string;
|
|
18
|
+
export declare function isTailwindV3(version: string | null): boolean;
|
|
19
|
+
export declare function ensureGlobalCssStylesheetImports(options: EnsureGlobalCssStylesheetImportsOptions): Promise<EnsureGlobalCssStylesheetImportsResult>;
|
|
@@ -6,25 +6,31 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const URLS: {
|
|
8
8
|
/** Default c15t cloud platform URL */
|
|
9
|
-
readonly CONSENT_IO: "https://
|
|
9
|
+
readonly CONSENT_IO: "https://inth.com";
|
|
10
|
+
/** First-party telemetry logs endpoint */
|
|
11
|
+
readonly TELEMETRY: "https://telemetry.c15t.com/c15t/v1/logs";
|
|
10
12
|
/** Documentation website */
|
|
11
|
-
readonly DOCS: "https://
|
|
13
|
+
readonly DOCS: "https://c15t.com/docs";
|
|
12
14
|
/** GitHub repository */
|
|
13
15
|
readonly GITHUB: "https://github.com/c15t/c15t";
|
|
14
16
|
/** Discord community */
|
|
15
|
-
readonly DISCORD: "https://
|
|
17
|
+
readonly DISCORD: "https://c15t.com/discord";
|
|
16
18
|
/** API documentation */
|
|
17
|
-
readonly API_DOCS: "https://
|
|
19
|
+
readonly API_DOCS: "https://c15t.com/docs/api";
|
|
18
20
|
/** CLI documentation */
|
|
19
|
-
readonly CLI_DOCS: "https://
|
|
21
|
+
readonly CLI_DOCS: "https://c15t.com/docs/cli";
|
|
20
22
|
/** Product changelog */
|
|
21
|
-
readonly CHANGELOG: "https://
|
|
23
|
+
readonly CHANGELOG: "https://c15t.com/changelog";
|
|
22
24
|
};
|
|
23
25
|
export declare const PATHS: {
|
|
24
26
|
/** c15t config directory name (in home dir) */
|
|
25
27
|
readonly CONFIG_DIR: ".c15t";
|
|
26
28
|
/** Config file name */
|
|
27
29
|
readonly CONFIG_FILE: "config.json";
|
|
30
|
+
/** Telemetry state file name */
|
|
31
|
+
readonly TELEMETRY_STATE_FILE: "telemetry.json";
|
|
32
|
+
/** Telemetry retry queue file name */
|
|
33
|
+
readonly TELEMETRY_QUEUE_FILE: "telemetry-queue.json";
|
|
28
34
|
/** Project config file name */
|
|
29
35
|
readonly PROJECT_CONFIG: "c15t.config.ts";
|
|
30
36
|
/** Alternative project config file name */
|
|
@@ -37,7 +43,7 @@ export declare const PATHS: {
|
|
|
37
43
|
export declare const REGEX: {
|
|
38
44
|
/** Generic URL pattern */
|
|
39
45
|
readonly URL: RegExp;
|
|
40
|
-
/** c15t platform URL pattern */
|
|
46
|
+
/** Hosted c15t platform URL pattern (legacy and current domains) */
|
|
41
47
|
readonly C15T_URL: RegExp;
|
|
42
48
|
/** Dynamic route segment pattern (e.g., [locale]) */
|
|
43
49
|
readonly DYNAMIC_SEGMENT: RegExp;
|
|
@@ -71,6 +77,12 @@ export declare const ENV_VARS: {
|
|
|
71
77
|
readonly V2: "V2";
|
|
72
78
|
/** Disable telemetry */
|
|
73
79
|
readonly TELEMETRY_DISABLED: "C15T_TELEMETRY_DISABLED";
|
|
80
|
+
/** Override telemetry ingest endpoint */
|
|
81
|
+
readonly TELEMETRY_ENDPOINT: "C15T_TELEMETRY_ENDPOINT";
|
|
82
|
+
/** Optional write key for telemetry ingest */
|
|
83
|
+
readonly TELEMETRY_WRITE_KEY: "C15T_TELEMETRY_WRITE_KEY";
|
|
84
|
+
/** Optional Axiom org ID for telemetry ingest */
|
|
85
|
+
readonly TELEMETRY_ORG_ID: "C15T_TELEMETRY_ORG_ID";
|
|
74
86
|
/** Control-plane/dashboard base URL override */
|
|
75
87
|
readonly CONSENT_URL: "CONSENT_URL";
|
|
76
88
|
/** c15t backend URL */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { C15TOptions } from '
|
|
1
|
+
import type { C15TOptions } from '@c15t/backend/core';
|
|
2
2
|
import type { CliLogger } from '../utils/logger';
|
|
3
3
|
import type { Telemetry } from '../utils/telemetry';
|
|
4
4
|
import type { FrameworkDetectionResult } from './framework-detection';
|
|
@@ -9,6 +9,8 @@ export interface CliCommand {
|
|
|
9
9
|
hint: string;
|
|
10
10
|
description: string;
|
|
11
11
|
action: (context: CliContext) => Promise<void>;
|
|
12
|
+
subcommands?: CliCommand[];
|
|
13
|
+
hidden?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export type FlagType = 'boolean' | 'string' | 'special';
|
|
14
16
|
export interface CliFlag {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Control-plane client for c15t
|
|
2
|
+
* Control-plane client for c15t hosted projects.
|
|
3
3
|
*/
|
|
4
4
|
import type { Instance } from '../types';
|
|
5
5
|
import type { ControlPlaneClientConfig, ControlPlaneConnectionState, ControlPlaneOrganization, ControlPlaneRegion, CreateInstanceRequest } from './types';
|
|
6
6
|
/**
|
|
7
|
-
* Client for c15t
|
|
7
|
+
* Client for c15t hosted projects.
|
|
8
8
|
*
|
|
9
9
|
* Uses direct control-plane HTTP endpoints under /api/v1.
|
|
10
10
|
*/
|
|
@@ -30,19 +30,19 @@ export declare class ControlPlaneClient {
|
|
|
30
30
|
listOrganizations(): Promise<ControlPlaneOrganization[]>;
|
|
31
31
|
listRegions(): Promise<ControlPlaneRegion[]>;
|
|
32
32
|
/**
|
|
33
|
-
* List all
|
|
33
|
+
* List all hosted projects for the authenticated user.
|
|
34
34
|
*/
|
|
35
35
|
listInstances(): Promise<Instance[]>;
|
|
36
36
|
/**
|
|
37
|
-
* Get a specific
|
|
37
|
+
* Get a specific hosted project by ID.
|
|
38
38
|
*/
|
|
39
39
|
getInstance(id: string): Promise<Instance>;
|
|
40
40
|
/**
|
|
41
|
-
* Create a new
|
|
41
|
+
* Create a new hosted project.
|
|
42
42
|
*/
|
|
43
43
|
createInstance(request: CreateInstanceRequest): Promise<Instance>;
|
|
44
44
|
/**
|
|
45
|
-
* Delete
|
|
45
|
+
* Delete a hosted project.
|
|
46
46
|
*/
|
|
47
47
|
deleteInstance(id: string): Promise<void>;
|
|
48
48
|
}
|
|
@@ -39,14 +39,14 @@ export interface ControlPlaneCapabilities {
|
|
|
39
39
|
version?: string;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Create
|
|
42
|
+
* Create hosted project request
|
|
43
43
|
*/
|
|
44
44
|
export interface CreateInstanceRequest {
|
|
45
|
-
/**
|
|
45
|
+
/** Project slug */
|
|
46
46
|
name: string;
|
|
47
|
-
/**
|
|
47
|
+
/** Project configuration */
|
|
48
48
|
config: {
|
|
49
|
-
/** Organization slug to create the
|
|
49
|
+
/** Organization slug to create the project under */
|
|
50
50
|
organizationSlug: string;
|
|
51
51
|
/** Region ID for provisioning */
|
|
52
52
|
region: string;
|
|
@@ -64,7 +64,7 @@ export interface ControlPlaneOrganization {
|
|
|
64
64
|
role: string;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* Provisioning region for control-plane
|
|
67
|
+
* Provisioning region for control-plane projects
|
|
68
68
|
*/
|
|
69
69
|
export interface ControlPlaneRegion {
|
|
70
70
|
id: string;
|