@ucptools/validator 1.0.1 → 1.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.
- package/dist/auth/config.d.ts +20 -0
- package/dist/auth/config.d.ts.map +1 -0
- package/dist/auth/config.js +114 -0
- package/dist/auth/config.js.map +1 -0
- package/dist/auth/index.d.ts +5 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +17 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware.d.ts +45 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +170 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/service.d.ts +80 -0
- package/dist/auth/service.d.ts.map +1 -0
- package/dist/auth/service.js +298 -0
- package/dist/auth/service.js.map +1 -0
- package/dist/cli/index.js +96 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/mock-server.d.ts +20 -0
- package/dist/cli/mock-server.d.ts.map +1 -0
- package/dist/cli/mock-server.js +261 -0
- package/dist/cli/mock-server.js.map +1 -0
- package/dist/db/index.d.ts +8 -2
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +22 -5
- package/dist/db/index.js.map +1 -1
- package/dist/db/schema.d.ts +3570 -128
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +377 -17
- package/dist/db/schema.js.map +1 -1
- package/dist/db/utils.d.ts +252 -0
- package/dist/db/utils.d.ts.map +1 -0
- package/dist/db/utils.js +295 -0
- package/dist/db/utils.js.map +1 -0
- package/dist/feed-analyzer/feed-analyzer.d.ts.map +1 -1
- package/dist/feed-analyzer/feed-analyzer.js +218 -4
- package/dist/feed-analyzer/feed-analyzer.js.map +1 -1
- package/dist/feed-analyzer/types.d.ts +82 -1
- package/dist/feed-analyzer/types.d.ts.map +1 -1
- package/dist/feed-analyzer/types.js +13 -0
- package/dist/feed-analyzer/types.js.map +1 -1
- package/dist/generator/profile-builder.d.ts.map +1 -1
- package/dist/generator/profile-builder.js +158 -115
- package/dist/generator/profile-builder.js.map +1 -1
- package/dist/lib/analytics.d.ts +349 -0
- package/dist/lib/analytics.d.ts.map +1 -0
- package/dist/lib/analytics.js +198 -0
- package/dist/lib/analytics.js.map +1 -0
- package/dist/security/security-scanner.d.ts.map +1 -1
- package/dist/security/security-scanner.js +130 -2
- package/dist/security/security-scanner.js.map +1 -1
- package/dist/security/types.d.ts +32 -0
- package/dist/security/types.d.ts.map +1 -1
- package/dist/security/types.js.map +1 -1
- package/dist/services/analytics.d.ts +114 -0
- package/dist/services/analytics.d.ts.map +1 -0
- package/dist/services/analytics.js +862 -0
- package/dist/services/analytics.js.map +1 -0
- package/dist/services/badge.d.ts +31 -0
- package/dist/services/badge.d.ts.map +1 -0
- package/dist/services/badge.js +152 -0
- package/dist/services/badge.js.map +1 -0
- package/dist/services/cron.d.ts +127 -0
- package/dist/services/cron.d.ts.map +1 -0
- package/dist/services/cron.js +693 -0
- package/dist/services/cron.js.map +1 -0
- package/dist/services/directory.d.ts +2 -0
- package/dist/services/directory.d.ts.map +1 -1
- package/dist/services/directory.js +45 -27
- package/dist/services/directory.js.map +1 -1
- package/dist/services/email.d.ts +127 -0
- package/dist/services/email.d.ts.map +1 -0
- package/dist/services/email.js +876 -0
- package/dist/services/email.js.map +1 -0
- package/dist/services/hosted-profiles.d.ts +77 -0
- package/dist/services/hosted-profiles.d.ts.map +1 -0
- package/dist/services/hosted-profiles.js +433 -0
- package/dist/services/hosted-profiles.js.map +1 -0
- package/dist/services/latency.d.ts +67 -0
- package/dist/services/latency.d.ts.map +1 -0
- package/dist/services/latency.js +274 -0
- package/dist/services/latency.js.map +1 -0
- package/dist/services/manifest-compliance.d.ts +64 -0
- package/dist/services/manifest-compliance.d.ts.map +1 -0
- package/dist/services/manifest-compliance.js +271 -0
- package/dist/services/manifest-compliance.js.map +1 -0
- package/dist/services/monitoring-diff.d.ts +31 -0
- package/dist/services/monitoring-diff.d.ts.map +1 -0
- package/dist/services/monitoring-diff.js +189 -0
- package/dist/services/monitoring-diff.js.map +1 -0
- package/dist/services/notifications.d.ts +46 -0
- package/dist/services/notifications.d.ts.map +1 -0
- package/dist/services/notifications.js +88 -0
- package/dist/services/notifications.js.map +1 -0
- package/dist/services/posthog.d.ts +43 -0
- package/dist/services/posthog.d.ts.map +1 -0
- package/dist/services/posthog.js +110 -0
- package/dist/services/posthog.js.map +1 -0
- package/dist/services/stripe.d.ts +93 -0
- package/dist/services/stripe.d.ts.map +1 -0
- package/dist/services/stripe.js +490 -0
- package/dist/services/stripe.js.map +1 -0
- package/dist/services/validation-history.d.ts +99 -0
- package/dist/services/validation-history.d.ts.map +1 -0
- package/dist/services/validation-history.js +344 -0
- package/dist/services/validation-history.js.map +1 -0
- package/dist/services/validation-logging.d.ts +103 -0
- package/dist/services/validation-logging.d.ts.map +1 -0
- package/dist/services/validation-logging.js +210 -0
- package/dist/services/validation-logging.js.map +1 -0
- package/dist/services/validation.d.ts +119 -0
- package/dist/services/validation.d.ts.map +1 -0
- package/dist/services/validation.js +1185 -0
- package/dist/services/validation.js.map +1 -0
- package/dist/simulator/agent-simulator.d.ts.map +1 -1
- package/dist/simulator/agent-simulator.js +229 -9
- package/dist/simulator/agent-simulator.js.map +1 -1
- package/dist/simulator/types.d.ts +26 -0
- package/dist/simulator/types.d.ts.map +1 -1
- package/dist/simulator/types.js.map +1 -1
- package/dist/types/acp-validation.d.ts +87 -0
- package/dist/types/acp-validation.d.ts.map +1 -0
- package/dist/types/acp-validation.js +40 -0
- package/dist/types/acp-validation.js.map +1 -0
- package/dist/types/analytics.d.ts +182 -0
- package/dist/types/analytics.d.ts.map +1 -0
- package/dist/types/analytics.js +7 -0
- package/dist/types/analytics.js.map +1 -0
- package/dist/types/generator.d.ts +4 -0
- package/dist/types/generator.d.ts.map +1 -1
- package/dist/types/ucp-profile.d.ts +32 -2
- package/dist/types/ucp-profile.d.ts.map +1 -1
- package/dist/types/ucp-profile.js +31 -1
- package/dist/types/ucp-profile.js.map +1 -1
- package/dist/types/validation.d.ts +14 -0
- package/dist/types/validation.d.ts.map +1 -1
- package/dist/types/validation.js +19 -0
- package/dist/types/validation.js.map +1 -1
- package/dist/validator/acp/index.d.ts +31 -0
- package/dist/validator/acp/index.d.ts.map +1 -0
- package/dist/validator/acp/index.js +574 -0
- package/dist/validator/acp/index.js.map +1 -0
- package/dist/validator/network-validator.d.ts.map +1 -1
- package/dist/validator/network-validator.js +23 -13
- package/dist/validator/network-validator.js.map +1 -1
- package/dist/validator/rules-validator.d.ts +8 -0
- package/dist/validator/rules-validator.d.ts.map +1 -1
- package/dist/validator/rules-validator.js +159 -43
- package/dist/validator/rules-validator.js.map +1 -1
- package/dist/validator/structural-validator.d.ts.map +1 -1
- package/dist/validator/structural-validator.js +283 -53
- package/dist/validator/structural-validator.js.map +1 -1
- package/dist/validator/utils.d.ts +62 -0
- package/dist/validator/utils.d.ts.map +1 -0
- package/dist/validator/utils.js +151 -0
- package/dist/validator/utils.js.map +1 -0
- package/package.json +45 -12
- package/.claude/settings.local.json +0 -60
- package/.vercel/README.txt +0 -11
- package/.vercel/project.json +0 -1
- package/publish-output.txt +0 -0
- package/tsconfig.json +0 -20
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monitoring Diff Engine
|
|
3
|
+
*
|
|
4
|
+
* Compares two ValidationResult objects to detect changes between scans.
|
|
5
|
+
* Classifies changes by severity: broken, degraded, changed, stable.
|
|
6
|
+
*/
|
|
7
|
+
import type { ValidationResult } from './validation.js';
|
|
8
|
+
export type MonitoringSeverity = 'broken' | 'degraded' | 'changed' | 'stable';
|
|
9
|
+
export interface ProfileChange {
|
|
10
|
+
field: string;
|
|
11
|
+
type: 'added' | 'removed' | 'changed';
|
|
12
|
+
oldValue?: string | number | boolean | null;
|
|
13
|
+
newValue?: string | number | boolean | null;
|
|
14
|
+
severity: 'error' | 'warn' | 'info';
|
|
15
|
+
}
|
|
16
|
+
export interface ProfileDiff {
|
|
17
|
+
severity: MonitoringSeverity;
|
|
18
|
+
changes: ProfileChange[];
|
|
19
|
+
summary: string;
|
|
20
|
+
scoreChange: number | null;
|
|
21
|
+
gradeChange: {
|
|
22
|
+
from: string;
|
|
23
|
+
to: string;
|
|
24
|
+
} | null;
|
|
25
|
+
ucpStatusChange: {
|
|
26
|
+
from: boolean;
|
|
27
|
+
to: boolean;
|
|
28
|
+
} | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function diffValidationResults(previous: ValidationResult, current: ValidationResult, threshold?: number): ProfileDiff;
|
|
31
|
+
//# sourceMappingURL=monitoring-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitoring-diff.d.ts","sourceRoot":"","sources":["../../src/services/monitoring-diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AAIzE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAC5C,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACjD,eAAe,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACxD;AAiCD,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,gBAAgB,EACzB,SAAS,GAAE,MAAW,GACrB,WAAW,CAmHb"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Monitoring Diff Engine
|
|
4
|
+
*
|
|
5
|
+
* Compares two ValidationResult objects to detect changes between scans.
|
|
6
|
+
* Classifies changes by severity: broken, degraded, changed, stable.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.diffValidationResults = diffValidationResults;
|
|
10
|
+
// ── Grade ordering (lower index = better) ────────────────────────────────────
|
|
11
|
+
const GRADE_ORDER = { A: 0, B: 1, C: 2, D: 3, F: 4 };
|
|
12
|
+
function gradeWorsened(from, to) {
|
|
13
|
+
return (GRADE_ORDER[to] ?? 99) > (GRADE_ORDER[from] ?? 99);
|
|
14
|
+
}
|
|
15
|
+
function gradeImproved(from, to) {
|
|
16
|
+
return (GRADE_ORDER[to] ?? 99) < (GRADE_ORDER[from] ?? 99);
|
|
17
|
+
}
|
|
18
|
+
function diffIssues(prev, curr) {
|
|
19
|
+
const prevCodes = new Set(prev.map(i => i.code));
|
|
20
|
+
const currCodes = new Set(curr.map(i => i.code));
|
|
21
|
+
return {
|
|
22
|
+
added: curr.filter(i => !prevCodes.has(i.code)),
|
|
23
|
+
removed: prev.filter(i => !currCodes.has(i.code)),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// ── Core diff function ───────────────────────────────────────────────────────
|
|
27
|
+
function diffValidationResults(previous, current, threshold = 10) {
|
|
28
|
+
const changes = [];
|
|
29
|
+
// 1. UCP presence
|
|
30
|
+
const ucpStatusChange = previous.ucp.found !== current.ucp.found
|
|
31
|
+
? { from: previous.ucp.found, to: current.ucp.found }
|
|
32
|
+
: null;
|
|
33
|
+
if (ucpStatusChange) {
|
|
34
|
+
changes.push({
|
|
35
|
+
field: 'ucp.found',
|
|
36
|
+
type: 'changed',
|
|
37
|
+
oldValue: previous.ucp.found,
|
|
38
|
+
newValue: current.ucp.found,
|
|
39
|
+
severity: current.ucp.found ? 'info' : 'error',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// 2. Score
|
|
43
|
+
const prevScore = previous.ai_readiness.score;
|
|
44
|
+
const currScore = current.ai_readiness.score;
|
|
45
|
+
const scoreChange = currScore - prevScore;
|
|
46
|
+
if (scoreChange !== 0) {
|
|
47
|
+
changes.push({
|
|
48
|
+
field: 'ai_readiness.score',
|
|
49
|
+
type: 'changed',
|
|
50
|
+
oldValue: prevScore,
|
|
51
|
+
newValue: currScore,
|
|
52
|
+
severity: scoreChange < -threshold ? 'error' : scoreChange < 0 ? 'warn' : 'info',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// 3. Grade
|
|
56
|
+
const prevGrade = previous.ai_readiness.grade;
|
|
57
|
+
const currGrade = current.ai_readiness.grade;
|
|
58
|
+
const gradeChange = prevGrade !== currGrade
|
|
59
|
+
? { from: prevGrade, to: currGrade }
|
|
60
|
+
: null;
|
|
61
|
+
if (gradeChange) {
|
|
62
|
+
changes.push({
|
|
63
|
+
field: 'ai_readiness.grade',
|
|
64
|
+
type: 'changed',
|
|
65
|
+
oldValue: prevGrade,
|
|
66
|
+
newValue: currGrade,
|
|
67
|
+
severity: gradeWorsened(prevGrade, currGrade) ? 'error' : 'info',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
// 4. UCP issues
|
|
71
|
+
const ucpIssueDiff = diffIssues(previous.ucp.issues || [], current.ucp.issues || []);
|
|
72
|
+
for (const issue of ucpIssueDiff.added) {
|
|
73
|
+
changes.push({
|
|
74
|
+
field: `ucp.issues.${issue.code}`,
|
|
75
|
+
type: 'added',
|
|
76
|
+
newValue: issue.message,
|
|
77
|
+
severity: issue.severity === 'error' ? 'error' : 'warn',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
for (const issue of ucpIssueDiff.removed) {
|
|
81
|
+
changes.push({
|
|
82
|
+
field: `ucp.issues.${issue.code}`,
|
|
83
|
+
type: 'removed',
|
|
84
|
+
oldValue: issue.message,
|
|
85
|
+
severity: 'info',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
// 5. Schema issues
|
|
89
|
+
const schemaIssueDiff = diffIssues(previous.schema.issues || [], current.schema.issues || []);
|
|
90
|
+
for (const issue of schemaIssueDiff.added) {
|
|
91
|
+
changes.push({
|
|
92
|
+
field: `schema.issues.${issue.code}`,
|
|
93
|
+
type: 'added',
|
|
94
|
+
newValue: issue.message,
|
|
95
|
+
severity: issue.severity === 'error' ? 'error' : 'warn',
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
for (const issue of schemaIssueDiff.removed) {
|
|
99
|
+
changes.push({
|
|
100
|
+
field: `schema.issues.${issue.code}`,
|
|
101
|
+
type: 'removed',
|
|
102
|
+
oldValue: issue.message,
|
|
103
|
+
severity: 'info',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// 6. Performance grade
|
|
107
|
+
if (previous.performance?.performanceGrade !== current.performance?.performanceGrade) {
|
|
108
|
+
changes.push({
|
|
109
|
+
field: 'performance.performanceGrade',
|
|
110
|
+
type: 'changed',
|
|
111
|
+
oldValue: previous.performance?.performanceGrade ?? null,
|
|
112
|
+
newValue: current.performance?.performanceGrade ?? null,
|
|
113
|
+
severity: 'info',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
// ── Classify severity ──────────────────────────────────────────────────────
|
|
117
|
+
const severity = classifySeverity(changes, ucpStatusChange, scoreChange, gradeChange, threshold);
|
|
118
|
+
// ── Generate summary ───────────────────────────────────────────────────────
|
|
119
|
+
const summary = generateSummary(severity, scoreChange, gradeChange, ucpStatusChange, changes);
|
|
120
|
+
return {
|
|
121
|
+
severity,
|
|
122
|
+
changes,
|
|
123
|
+
summary,
|
|
124
|
+
scoreChange: scoreChange !== 0 ? scoreChange : null,
|
|
125
|
+
gradeChange,
|
|
126
|
+
ucpStatusChange,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// ── Severity classification ──────────────────────────────────────────────────
|
|
130
|
+
function classifySeverity(changes, ucpStatusChange, scoreChange, gradeChange, threshold) {
|
|
131
|
+
// Broken: UCP profile disappeared or score dropped to 0
|
|
132
|
+
if (ucpStatusChange && ucpStatusChange.from === true && ucpStatusChange.to === false) {
|
|
133
|
+
return 'broken';
|
|
134
|
+
}
|
|
135
|
+
// Degraded: grade worsened, or score dropped >= threshold, or new error-severity issues
|
|
136
|
+
if (gradeChange && gradeWorsened(gradeChange.from, gradeChange.to)) {
|
|
137
|
+
return 'degraded';
|
|
138
|
+
}
|
|
139
|
+
if (scoreChange <= -threshold) {
|
|
140
|
+
return 'degraded';
|
|
141
|
+
}
|
|
142
|
+
const hasNewErrors = changes.some(c => c.type === 'added' && c.severity === 'error');
|
|
143
|
+
if (hasNewErrors) {
|
|
144
|
+
return 'degraded';
|
|
145
|
+
}
|
|
146
|
+
// Stable: no meaningful changes at all, or only a tiny score fluctuation
|
|
147
|
+
if (changes.length === 0) {
|
|
148
|
+
return 'stable';
|
|
149
|
+
}
|
|
150
|
+
const onlySmallScoreChange = changes.every(c => c.field === 'ai_readiness.score') && Math.abs(scoreChange) <= 2;
|
|
151
|
+
if (onlySmallScoreChange) {
|
|
152
|
+
return 'stable';
|
|
153
|
+
}
|
|
154
|
+
// Changed: anything else (improvements, informational changes)
|
|
155
|
+
return 'changed';
|
|
156
|
+
}
|
|
157
|
+
// ── Summary generation ───────────────────────────────────────────────────────
|
|
158
|
+
function generateSummary(severity, scoreChange, gradeChange, ucpStatusChange, changes) {
|
|
159
|
+
if (severity === 'stable') {
|
|
160
|
+
return 'No meaningful changes detected';
|
|
161
|
+
}
|
|
162
|
+
const parts = [];
|
|
163
|
+
if (ucpStatusChange) {
|
|
164
|
+
if (!ucpStatusChange.to) {
|
|
165
|
+
parts.push('UCP profile no longer found');
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
parts.push('UCP profile restored');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (scoreChange !== 0) {
|
|
172
|
+
const direction = scoreChange > 0 ? 'improved' : 'dropped';
|
|
173
|
+
parts.push(`Score ${direction} by ${Math.abs(scoreChange)} points`);
|
|
174
|
+
}
|
|
175
|
+
if (gradeChange) {
|
|
176
|
+
const direction = gradeImproved(gradeChange.from, gradeChange.to) ? 'improved' : 'dropped';
|
|
177
|
+
parts.push(`Grade ${direction} from ${gradeChange.from} to ${gradeChange.to}`);
|
|
178
|
+
}
|
|
179
|
+
const newErrors = changes.filter(c => c.type === 'added' && c.severity === 'error');
|
|
180
|
+
if (newErrors.length > 0) {
|
|
181
|
+
parts.push(`${newErrors.length} new error(s)`);
|
|
182
|
+
}
|
|
183
|
+
const resolvedIssues = changes.filter(c => c.type === 'removed');
|
|
184
|
+
if (resolvedIssues.length > 0) {
|
|
185
|
+
parts.push(`${resolvedIssues.length} issue(s) resolved`);
|
|
186
|
+
}
|
|
187
|
+
return parts.join('. ') || 'Profile changes detected';
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=monitoring-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitoring-diff.js","sourceRoot":"","sources":["../../src/services/monitoring-diff.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAwDH,sDAuHC;AAtJD,gFAAgF;AAEhF,MAAM,WAAW,GAA2B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAE7E,SAAS,aAAa,CAAC,IAAY,EAA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AM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACjE,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,MAAM,oBAAoB,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,0BAA0B,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Service
|
|
3
|
+
*
|
|
4
|
+
* Handles outbound notifications via Slack webhooks.
|
|
5
|
+
* All notifications are fire-and-forget to avoid blocking main operations.
|
|
6
|
+
*/
|
|
7
|
+
export interface NotificationUser {
|
|
8
|
+
id: string;
|
|
9
|
+
email: string;
|
|
10
|
+
name: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface NotificationSubscription {
|
|
13
|
+
tier: string;
|
|
14
|
+
status: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Send signup notification to Slack
|
|
18
|
+
*/
|
|
19
|
+
export interface WebhookPayload {
|
|
20
|
+
event: 'profile_broken' | 'profile_degraded' | 'profile_changed';
|
|
21
|
+
domain: string;
|
|
22
|
+
severity: string;
|
|
23
|
+
oldScore: number | null;
|
|
24
|
+
newScore: number;
|
|
25
|
+
oldGrade: string | null;
|
|
26
|
+
newGrade: string;
|
|
27
|
+
changes: Array<{
|
|
28
|
+
field: string;
|
|
29
|
+
type: string;
|
|
30
|
+
oldValue?: string | number | boolean | null;
|
|
31
|
+
newValue?: string | number | boolean | null;
|
|
32
|
+
}>;
|
|
33
|
+
summary: string;
|
|
34
|
+
timestamp: string;
|
|
35
|
+
dashboardUrl: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Send webhook notification for domain monitoring changes.
|
|
39
|
+
* Fire-and-forget - logs errors but never throws.
|
|
40
|
+
*/
|
|
41
|
+
export declare function sendDomainWebhook(webhookUrl: string, payload: WebhookPayload): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Send signup notification to Slack
|
|
44
|
+
*/
|
|
45
|
+
export declare function notifySignup(user: NotificationUser, subscription: NotificationSubscription): Promise<void>;
|
|
46
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/services/notifications.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;QAC5C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;KAC7C,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,CAAC,CAuBlB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,gBAAgB,EACtB,YAAY,EAAE,wBAAwB,GACrC,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Notification Service
|
|
4
|
+
*
|
|
5
|
+
* Handles outbound notifications via Slack webhooks.
|
|
6
|
+
* All notifications are fire-and-forget to avoid blocking main operations.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.sendDomainWebhook = sendDomainWebhook;
|
|
10
|
+
exports.notifySignup = notifySignup;
|
|
11
|
+
/**
|
|
12
|
+
* Send webhook notification for domain monitoring changes.
|
|
13
|
+
* Fire-and-forget - logs errors but never throws.
|
|
14
|
+
*/
|
|
15
|
+
async function sendDomainWebhook(webhookUrl, payload) {
|
|
16
|
+
try {
|
|
17
|
+
const response = await fetch(webhookUrl, {
|
|
18
|
+
method: 'POST',
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
'User-Agent': 'UCPtools-Webhook/1.0',
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify(payload),
|
|
24
|
+
signal: AbortSignal.timeout(10000), // 10s timeout
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
console.error(`[Webhook] Failed to send to ${webhookUrl}: ${response.status}`);
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
console.log(`[Webhook] Sent ${payload.event} notification for ${payload.domain}`);
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error(`[Webhook] Error sending to ${webhookUrl}:`, error instanceof Error ? error.message : error);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Send signup notification to Slack
|
|
40
|
+
*/
|
|
41
|
+
async function notifySignup(user, subscription) {
|
|
42
|
+
const webhookUrl = process.env.SLACK_WEBHOOK_URL;
|
|
43
|
+
if (!webhookUrl) {
|
|
44
|
+
console.log('[Slack] No webhook URL configured, skipping notification');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const message = {
|
|
48
|
+
blocks: [
|
|
49
|
+
{
|
|
50
|
+
type: 'header',
|
|
51
|
+
text: { type: 'plain_text', text: '🎉 New Customer Signup!' }
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: 'section',
|
|
55
|
+
fields: [
|
|
56
|
+
{ type: 'mrkdwn', text: `*Email:*\n${user.email}` },
|
|
57
|
+
{ type: 'mrkdwn', text: `*Name:*\n${user.name || 'Not provided'}` },
|
|
58
|
+
{ type: 'mrkdwn', text: `*Tier:*\n${subscription.tier}` },
|
|
59
|
+
{ type: 'mrkdwn', text: `*Status:*\n${subscription.status}` }
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'context',
|
|
64
|
+
elements: [
|
|
65
|
+
{ type: 'mrkdwn', text: `User ID: ${user.id} | ${new Date().toISOString()}` }
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
// Fire-and-forget - don't await, don't block
|
|
71
|
+
fetch(webhookUrl, {
|
|
72
|
+
method: 'POST',
|
|
73
|
+
headers: { 'Content-Type': 'application/json' },
|
|
74
|
+
body: JSON.stringify(message)
|
|
75
|
+
})
|
|
76
|
+
.then(response => {
|
|
77
|
+
if (!response.ok) {
|
|
78
|
+
console.error(`[Slack] Notification failed: ${response.status}`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
console.log(`[Slack] Signup notification sent for ${user.email}`);
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.catch(err => {
|
|
85
|
+
console.error('[Slack] Notification error:', err.message);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/services/notifications.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAuCH,8CA0BC;AAKD,oCAkDC;AArFD;;;GAGG;AACI,KAAK,UAAU,iBAAiB,CACrC,UAAkB,EAClB,OAAuB;IAEvB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE;YACvC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,YAAY,EAAE,sBAAsB;aACrC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC7B,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,cAAc;SACnD,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,+BAA+B,UAAU,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YAC/E,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,OAAO,CAAC,KAAK,qBAAqB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,UAAU,GAAG,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC3G,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,YAAY,CAChC,IAAsB,EACtB,YAA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O,CAAC,KAAK,CAAC,gCAAgC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,wCAAwC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,CAAC;SACD,KAAK,CAAC,GAAG,CAAC,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track trial_started event server-side.
|
|
3
|
+
* This is the source of truth — client-side tracking is unreliable
|
|
4
|
+
* due to page navigation race conditions and ad blockers.
|
|
5
|
+
*/
|
|
6
|
+
export declare function trackTrialStarted(params: {
|
|
7
|
+
userId: string;
|
|
8
|
+
email: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
method: 'email' | 'google';
|
|
11
|
+
}): void;
|
|
12
|
+
/**
|
|
13
|
+
* Track signup_completed event server-side.
|
|
14
|
+
*/
|
|
15
|
+
export declare function trackSignupCompleted(params: {
|
|
16
|
+
userId: string;
|
|
17
|
+
email: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
method: 'email' | 'google';
|
|
20
|
+
}): void;
|
|
21
|
+
/**
|
|
22
|
+
* Identify a user in PostHog server-side.
|
|
23
|
+
*/
|
|
24
|
+
export declare function identifyUser(params: {
|
|
25
|
+
userId: string;
|
|
26
|
+
email: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
}): void;
|
|
29
|
+
/**
|
|
30
|
+
* Track email_sent event server-side.
|
|
31
|
+
* Instruments the trial drip sequence and alerts for funnel visibility.
|
|
32
|
+
*/
|
|
33
|
+
export declare function trackEmailSent(params: {
|
|
34
|
+
userId: string;
|
|
35
|
+
email: string;
|
|
36
|
+
emailType: string;
|
|
37
|
+
success: boolean;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Flush pending events. Call on server shutdown.
|
|
41
|
+
*/
|
|
42
|
+
export declare function shutdownPostHog(): Promise<void>;
|
|
43
|
+
//# sourceMappingURL=posthog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog.d.ts","sourceRoot":"","sources":["../../src/services/posthog.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B,GAAG,IAAI,CAeP;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B,GAAG,IAAI,CAeP;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,IAAI,CAWP;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAeP;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAKrD"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackTrialStarted = trackTrialStarted;
|
|
4
|
+
exports.trackSignupCompleted = trackSignupCompleted;
|
|
5
|
+
exports.identifyUser = identifyUser;
|
|
6
|
+
exports.trackEmailSent = trackEmailSent;
|
|
7
|
+
exports.shutdownPostHog = shutdownPostHog;
|
|
8
|
+
const posthog_node_1 = require("posthog-node");
|
|
9
|
+
let posthogClient = null;
|
|
10
|
+
function getPostHogClient() {
|
|
11
|
+
if (posthogClient)
|
|
12
|
+
return posthogClient;
|
|
13
|
+
const apiKey = process.env.POSTHOG_API_KEY || process.env.NEXT_PUBLIC_POSTHOG_KEY;
|
|
14
|
+
const host = process.env.POSTHOG_HOST || process.env.NEXT_PUBLIC_POSTHOG_HOST;
|
|
15
|
+
if (!apiKey) {
|
|
16
|
+
console.warn('[PostHog] No API key configured, server-side tracking disabled');
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
posthogClient = new posthog_node_1.PostHog(apiKey, {
|
|
20
|
+
host: host || 'https://eu.i.posthog.com',
|
|
21
|
+
flushAt: 1, // Send events immediately (low volume)
|
|
22
|
+
flushInterval: 0, // Don't batch
|
|
23
|
+
});
|
|
24
|
+
return posthogClient;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Track trial_started event server-side.
|
|
28
|
+
* This is the source of truth — client-side tracking is unreliable
|
|
29
|
+
* due to page navigation race conditions and ad blockers.
|
|
30
|
+
*/
|
|
31
|
+
function trackTrialStarted(params) {
|
|
32
|
+
const client = getPostHogClient();
|
|
33
|
+
if (!client)
|
|
34
|
+
return;
|
|
35
|
+
client.capture({
|
|
36
|
+
distinctId: params.userId,
|
|
37
|
+
event: 'trial_started',
|
|
38
|
+
properties: {
|
|
39
|
+
method: params.method,
|
|
40
|
+
$set: {
|
|
41
|
+
email: params.email,
|
|
42
|
+
name: params.name,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Track signup_completed event server-side.
|
|
49
|
+
*/
|
|
50
|
+
function trackSignupCompleted(params) {
|
|
51
|
+
const client = getPostHogClient();
|
|
52
|
+
if (!client)
|
|
53
|
+
return;
|
|
54
|
+
client.capture({
|
|
55
|
+
distinctId: params.userId,
|
|
56
|
+
event: 'signup_completed',
|
|
57
|
+
properties: {
|
|
58
|
+
method: params.method,
|
|
59
|
+
$set: {
|
|
60
|
+
email: params.email,
|
|
61
|
+
name: params.name,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Identify a user in PostHog server-side.
|
|
68
|
+
*/
|
|
69
|
+
function identifyUser(params) {
|
|
70
|
+
const client = getPostHogClient();
|
|
71
|
+
if (!client)
|
|
72
|
+
return;
|
|
73
|
+
client.identify({
|
|
74
|
+
distinctId: params.userId,
|
|
75
|
+
properties: {
|
|
76
|
+
email: params.email,
|
|
77
|
+
name: params.name,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Track email_sent event server-side.
|
|
83
|
+
* Instruments the trial drip sequence and alerts for funnel visibility.
|
|
84
|
+
*/
|
|
85
|
+
function trackEmailSent(params) {
|
|
86
|
+
const client = getPostHogClient();
|
|
87
|
+
if (!client)
|
|
88
|
+
return;
|
|
89
|
+
client.capture({
|
|
90
|
+
distinctId: params.userId,
|
|
91
|
+
event: 'email_sent',
|
|
92
|
+
properties: {
|
|
93
|
+
email_type: params.emailType,
|
|
94
|
+
success: params.success,
|
|
95
|
+
$set: {
|
|
96
|
+
email: params.email,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Flush pending events. Call on server shutdown.
|
|
103
|
+
*/
|
|
104
|
+
async function shutdownPostHog() {
|
|
105
|
+
if (posthogClient) {
|
|
106
|
+
await posthogClient.shutdown();
|
|
107
|
+
posthogClient = null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingUR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AAC;QAC/B,aAAa,GAAG,IAAI,CAAC;IACzB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stripe Service
|
|
3
|
+
* Handles all Stripe-related operations including:
|
|
4
|
+
* - Checkout session creation
|
|
5
|
+
* - Subscription management
|
|
6
|
+
* - Customer portal
|
|
7
|
+
* - Webhook events
|
|
8
|
+
* Production deployment ready
|
|
9
|
+
*/
|
|
10
|
+
import Stripe from 'stripe';
|
|
11
|
+
type SubscriptionTier = 'free' | 'starter' | 'pro' | 'business';
|
|
12
|
+
/**
|
|
13
|
+
* Get the Stripe instance, throwing an error if not configured.
|
|
14
|
+
* This allows the app to start even without Stripe keys,
|
|
15
|
+
* failing only when Stripe features are actually used.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getStripe(): Stripe;
|
|
18
|
+
export declare const stripe: Stripe;
|
|
19
|
+
export declare const STRIPE_PRICE_IDS: {
|
|
20
|
+
starter_monthly: string;
|
|
21
|
+
starter_annual: string;
|
|
22
|
+
pro_monthly: string;
|
|
23
|
+
pro_annual: string;
|
|
24
|
+
business_monthly: string;
|
|
25
|
+
business_annual: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Map Stripe price ID to subscription tier
|
|
29
|
+
*/
|
|
30
|
+
export declare function priceIdToTier(priceId: string): SubscriptionTier;
|
|
31
|
+
/**
|
|
32
|
+
* Create a Stripe checkout session for a new subscription
|
|
33
|
+
*/
|
|
34
|
+
export declare function createCheckoutSession(params: {
|
|
35
|
+
userId: string;
|
|
36
|
+
userEmail: string;
|
|
37
|
+
priceId: string;
|
|
38
|
+
successUrl: string;
|
|
39
|
+
cancelUrl: string;
|
|
40
|
+
trialDays?: number;
|
|
41
|
+
}): Promise<Stripe.Checkout.Session>;
|
|
42
|
+
/**
|
|
43
|
+
* Create a customer portal session for managing subscription
|
|
44
|
+
*/
|
|
45
|
+
export declare function createCustomerPortalSession(params: {
|
|
46
|
+
customerId: string;
|
|
47
|
+
returnUrl: string;
|
|
48
|
+
}): Promise<Stripe.BillingPortal.Session>;
|
|
49
|
+
/**
|
|
50
|
+
* Start a free trial without requiring a credit card
|
|
51
|
+
* Creates a Stripe customer for future conversion, and a local subscription record
|
|
52
|
+
*
|
|
53
|
+
* @param userId - The user's ID in our database
|
|
54
|
+
* @param userEmail - The user's email address
|
|
55
|
+
* @param userName - Optional user name
|
|
56
|
+
* @param trialDays - Number of trial days (default 7)
|
|
57
|
+
* @returns The created Stripe customer ID and trial end date
|
|
58
|
+
*/
|
|
59
|
+
export declare function startTrialWithoutPayment(params: {
|
|
60
|
+
userId: string;
|
|
61
|
+
userEmail: string;
|
|
62
|
+
userName?: string;
|
|
63
|
+
trialDays?: number;
|
|
64
|
+
}): Promise<{
|
|
65
|
+
customerId: string;
|
|
66
|
+
trialEndsAt: Date;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Handle Stripe webhook events
|
|
70
|
+
*/
|
|
71
|
+
export declare function handleWebhookEvent(event: Stripe.Event): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Verify Stripe webhook signature
|
|
74
|
+
*/
|
|
75
|
+
export declare function verifyWebhookSignature(payload: string | Buffer, signature: string, secret: string): Stripe.Event;
|
|
76
|
+
/**
|
|
77
|
+
* Get subscription details for a user
|
|
78
|
+
*/
|
|
79
|
+
export declare function getSubscriptionDetails(stripeSubscriptionId: string): Promise<Stripe.Subscription | null>;
|
|
80
|
+
/**
|
|
81
|
+
* Cancel a subscription at period end
|
|
82
|
+
*/
|
|
83
|
+
export declare function cancelSubscription(stripeSubscriptionId: string): Promise<Stripe.Subscription>;
|
|
84
|
+
/**
|
|
85
|
+
* Resume a canceled subscription
|
|
86
|
+
*/
|
|
87
|
+
export declare function resumeSubscription(stripeSubscriptionId: string): Promise<Stripe.Subscription>;
|
|
88
|
+
/**
|
|
89
|
+
* Update subscription to a new price (upgrade/downgrade)
|
|
90
|
+
*/
|
|
91
|
+
export declare function updateSubscription(stripeSubscriptionId: string, newPriceId: string): Promise<Stripe.Subscription>;
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=stripe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../src/services/stripe.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAQ5B,KAAK,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC;AAgBhE;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAQlC;AAGD,eAAO,MAAM,MAAM,QAIjB,CAAC;AAKH,eAAO,MAAM,gBAAgB;;;;;;;CAsB5B,CAAC;AAUF;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CA6B/D;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAuDnC;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAAC,MAAM,EAAE;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAQxC;AAED;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAA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