@usefidel/contracts 0.8.0 → 0.9.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.
@@ -112,7 +112,7 @@ export declare function errorPhaseFor(code: string | null | undefined): Validati
112
112
  /** True when `code` is a member of the current taxonomy. */
113
113
  export declare function isKnownErrorCode(code: string | null | undefined): code is RunErrorCode;
114
114
  /** Events the GA dashboard is built on. Typed properties, specified triggers. */
115
- export declare const GA_EVENT_NAMES: readonly ["signup_started", "signup_completed", "onboarding_started", "onboarding_completed", "figma_connected", "environment_connected", "web_validation_started", "web_validation_completed", "web_validation_failed", "web_validation_cancelled", "report_viewed", "report_shared", "diff_mark_resolved", "upgrade_clicked", "checkout_started", "feedback_submitted", "extension_opened", "validation_start", "validation_accepted", "validation_complete", "validation_error", "validation_cancel", "review_saved", "figma_auth_success", "figma_auth_error", "extension_share_copied", "upgrade_modal_viewed", "upgrade_cta_clicked"];
115
+ export declare const GA_EVENT_NAMES: readonly ["signup_started", "signup_completed", "onboarding_started", "onboarding_completed", "figma_connected", "environment_connected", "web_validation_submitted", "web_validation_completed", "web_validation_failed", "web_validation_cancelled", "report_viewed", "report_share_created", "report_link_copied", "report_share_failed", "report_copy_failed", "diff_mark_resolved", "upgrade_clicked", "checkout_started", "feedback_submitted", "extension_opened", "validation_start", "validation_accepted", "validation_complete", "validation_error", "validation_cancel", "review_saved", "figma_auth_success", "figma_auth_error", "extension_share_copied", "upgrade_modal_viewed", "upgrade_cta_clicked"];
116
116
  /**
117
117
  * Events that exist but are NOT GA metrics.
118
118
  *
@@ -125,7 +125,7 @@ export declare const GA_EVENT_NAMES: readonly ["signup_started", "signup_complet
125
125
  */
126
126
  export declare const SECONDARY_EVENT_NAMES: readonly ["checkout_completed", "console_errors", "diff_expanded", "drawer_filter_changed", "review_save_error", "review_verdict", "review_verdict_all", "screenshot_exported", "ui_crash", "validation_resume", "validation_retry", "view_changed", "auth_refresh", "consensus_complete", "consensus_error", "extension_validation_failed", "idempotency_dedup_client", "pipeline_complete", "pipeline_phase", "pipeline_resume", "rate_limit_hit", "upgrade_wall_hit"];
127
127
  /** Every event name any Fidel client may emit. */
128
- export declare const ANALYTICS_EVENT_NAMES: readonly ["signup_started", "signup_completed", "onboarding_started", "onboarding_completed", "figma_connected", "environment_connected", "web_validation_started", "web_validation_completed", "web_validation_failed", "web_validation_cancelled", "report_viewed", "report_shared", "diff_mark_resolved", "upgrade_clicked", "checkout_started", "feedback_submitted", "extension_opened", "validation_start", "validation_accepted", "validation_complete", "validation_error", "validation_cancel", "review_saved", "figma_auth_success", "figma_auth_error", "extension_share_copied", "upgrade_modal_viewed", "upgrade_cta_clicked", "checkout_completed", "console_errors", "diff_expanded", "drawer_filter_changed", "review_save_error", "review_verdict", "review_verdict_all", "screenshot_exported", "ui_crash", "validation_resume", "validation_retry", "view_changed", "auth_refresh", "consensus_complete", "consensus_error", "extension_validation_failed", "idempotency_dedup_client", "pipeline_complete", "pipeline_phase", "pipeline_resume", "rate_limit_hit", "upgrade_wall_hit"];
128
+ export declare const ANALYTICS_EVENT_NAMES: readonly ["signup_started", "signup_completed", "onboarding_started", "onboarding_completed", "figma_connected", "environment_connected", "web_validation_submitted", "web_validation_completed", "web_validation_failed", "web_validation_cancelled", "report_viewed", "report_share_created", "report_link_copied", "report_share_failed", "report_copy_failed", "diff_mark_resolved", "upgrade_clicked", "checkout_started", "feedback_submitted", "extension_opened", "validation_start", "validation_accepted", "validation_complete", "validation_error", "validation_cancel", "review_saved", "figma_auth_success", "figma_auth_error", "extension_share_copied", "upgrade_modal_viewed", "upgrade_cta_clicked", "checkout_completed", "console_errors", "diff_expanded", "drawer_filter_changed", "review_save_error", "review_verdict", "review_verdict_all", "screenshot_exported", "ui_crash", "validation_resume", "validation_retry", "view_changed", "auth_refresh", "consensus_complete", "consensus_error", "extension_validation_failed", "idempotency_dedup_client", "pipeline_complete", "pipeline_phase", "pipeline_resume", "rate_limit_hit", "upgrade_wall_hit"];
129
129
  export type GaEventName = (typeof GA_EVENT_NAMES)[number];
130
130
  export type SecondaryEventName = (typeof SECONDARY_EVENT_NAMES)[number];
131
131
  export type AnalyticsEventName = GaEventName | SecondaryEventName;
@@ -170,10 +170,51 @@ export interface ValidationEventProperties {
170
170
  run_id: string;
171
171
  validation_mode: ValidationMode;
172
172
  }
173
- export interface ValidationStartedProperties extends ValidationEventProperties {
173
+ /**
174
+ * The backend ACCEPTED a validation request and issued a run id.
175
+ *
176
+ * Named `submitted`, not `started`, because the transition it records is the
177
+ * server's acceptance rather than the user's click. The predecessor fired
178
+ * before the request left the browser, which meant a run rejected at the
179
+ * upgrade wall still counted as started and no event could carry a `run_id`.
180
+ * This one cannot be emitted without one.
181
+ *
182
+ * NOT a terminal event: exactly one of completed / failed / cancelled follows.
183
+ */
184
+ export interface ValidationSubmittedProperties extends ValidationEventProperties {
185
+ /**
186
+ * ABSENT where the surface has no viewport control. Absence is the honest
187
+ * encoding of "not applicable" — a default substituted here would be
188
+ * indistinguishable from a real user selection.
189
+ */
174
190
  viewport?: string;
175
191
  is_revalidation?: boolean;
176
192
  }
193
+ /**
194
+ * A share link was created, or its URL was copied.
195
+ *
196
+ * `report_shared` was retired in 0.9.0 because it could not answer the only
197
+ * question it was asked. It fired on button CLICK, so it counted intents, not
198
+ * shares: a failed token mint and a successful copy were the same event, and a
199
+ * user who clicked three times and never got a URL looked like three shares.
200
+ * Creating a link and copying it are also genuinely different acts — a link
201
+ * created and never copied was never delivered to anyone.
202
+ */
203
+ export interface ReportShareProperties {
204
+ run_id: string;
205
+ /** Which surface offered the control; the two share entry points differ. */
206
+ share_surface: 'report' | 'project';
207
+ }
208
+ /** Share-token creation failed, or the URL exists but the clipboard refused. */
209
+ export interface ReportShareFailureProperties {
210
+ run_id: string;
211
+ share_surface: 'report' | 'project';
212
+ /**
213
+ * Bounded reason. Never the raw exception: clipboard and network errors
214
+ * carry browser-supplied text and, in the network case, the request URL.
215
+ */
216
+ error_code: string;
217
+ }
177
218
  export interface WebValidationCompletedProperties extends ValidationEventProperties {
178
219
  duration_ms: number;
179
220
  /**
@@ -253,14 +294,15 @@ export interface AnalyticsEventProperties {
253
294
  environment_connected: {
254
295
  connection_type: string;
255
296
  };
256
- web_validation_started: ValidationStartedProperties;
297
+ web_validation_submitted: ValidationSubmittedProperties;
257
298
  web_validation_completed: WebValidationCompletedProperties;
258
299
  web_validation_failed: ValidationFailedProperties;
259
300
  web_validation_cancelled: ValidationCancelledProperties;
260
301
  report_viewed: ReportViewedProperties;
261
- report_shared: {
262
- run_id: string;
263
- };
302
+ report_share_created: ReportShareProperties;
303
+ report_link_copied: ReportShareProperties;
304
+ report_share_failed: ReportShareFailureProperties;
305
+ report_copy_failed: ReportShareFailureProperties;
264
306
  diff_mark_resolved: {
265
307
  run_id: string;
266
308
  review_action: string;
@@ -282,7 +324,7 @@ export interface AnalyticsEventProperties {
282
324
  validation_mode: ValidationMode;
283
325
  };
284
326
  /** The backend accepted the run and issued a run id. The GA "started" event. */
285
- validation_accepted: ValidationStartedProperties;
327
+ validation_accepted: ValidationSubmittedProperties;
286
328
  validation_complete: WebValidationCompletedProperties;
287
329
  validation_error: ValidationFailedProperties;
288
330
  validation_cancel: ValidationCancelledProperties;
package/dist/analytics.js CHANGED
@@ -116,12 +116,15 @@ export const GA_EVENT_NAMES = [
116
116
  'onboarding_completed',
117
117
  'figma_connected',
118
118
  'environment_connected',
119
- 'web_validation_started',
119
+ 'web_validation_submitted',
120
120
  'web_validation_completed',
121
121
  'web_validation_failed',
122
122
  'web_validation_cancelled',
123
123
  'report_viewed',
124
- 'report_shared',
124
+ 'report_share_created',
125
+ 'report_link_copied',
126
+ 'report_share_failed',
127
+ 'report_copy_failed',
125
128
  'diff_mark_resolved',
126
129
  'upgrade_clicked',
127
130
  'checkout_started',
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { RUN_ERROR_CODES, ERROR_CODE_META, mapSnapshotErrorToCode, mapFigmaError
2
2
  export type { RunErrorCode, RunErrorMeta, ErrorMapping, RunDisplay, } from './run-errors.js';
3
3
  export type { IntakeFramework, UnsupportedStack, UnsupportedReason, UnresolvedReferenceSection, UnresolvedReferenceReason, UnresolvedReference, ParsedThemeColor, ParsedThemeTypography, ParsedThemeSize, ShadcnConfig, ParsedTheme, IntakeDetection, TokenSourceKind, TokenSource, PackageRole, PackageInfo, } from './theme-intake.js';
4
4
  export { ANALYTICS_SCHEMA_VERSION, ANALYTICS_EVENT_NAMES, GA_EVENT_NAMES, SECONDARY_EVENT_NAMES, ERROR_CODE_PHASE, FORBIDDEN_PROPERTY_KEYS, errorPhaseFor, isKnownErrorCode, sanitizeProperties, } from './analytics.js';
5
- export type { AnalyticsSurface, AnalyticsEnvironment, AnalyticsContext, AnalyticsPersonProperties, AnalyticsEventName, GaEventName, SecondaryEventName, AnalyticsEventProperties, AnalyticsPayload, ValidationMode, ValidationErrorPhase, ResultCompleteness, ValidationEventProperties, ValidationStartedProperties, WebValidationCompletedProperties, ValidationFailedProperties, ValidationCancelledProperties, ReportViewedProperties, } from './analytics.js';
5
+ export type { AnalyticsSurface, AnalyticsEnvironment, AnalyticsContext, AnalyticsPersonProperties, AnalyticsEventName, GaEventName, SecondaryEventName, AnalyticsEventProperties, AnalyticsPayload, ValidationMode, ValidationErrorPhase, ResultCompleteness, ValidationEventProperties, ValidationSubmittedProperties, ReportShareProperties, ReportShareFailureProperties, WebValidationCompletedProperties, ValidationFailedProperties, ValidationCancelledProperties, ReportViewedProperties, } from './analytics.js';
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "The source of truth still lives in the monorepo at packages/contracts/."
8
8
  ],
9
9
  "name": "@usefidel/contracts",
10
- "version": "0.8.0",
10
+ "version": "0.9.0",
11
11
  "description": "Shared, code-free contracts between Fidel surfaces. Run-error taxonomy, theme-intake wire types, and the canonical fidel.config.json builders.",
12
12
  "license": "UNLICENSED",
13
13
  "private": false,