@insure-os/client 0.0.83 → 0.0.85

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/index.d.ts CHANGED
@@ -684,7 +684,36 @@ declare enum ErrorType {
684
684
  VALIDATION_ERROR = "VALIDATION_ERROR",
685
685
  STORAGE_ERROR = "STORAGE_ERROR",
686
686
  TIMEOUT_ERROR = "TIMEOUT_ERROR",
687
- MAINTENANCE_ERROR = "MAINTENANCE_ERROR"
687
+ MAINTENANCE_ERROR = "MAINTENANCE_ERROR",
688
+ /**
689
+ * The engine refused to operate on this quote intent because its stored
690
+ * product_version has drifted from the version its cover_start_date
691
+ * now resolves to, AND the new version's form_definition differs
692
+ * structurally from the old one. The user must start a fresh quote —
693
+ * their saved answers cannot be safely carried over.
694
+ *
695
+ * Surfaced as HTTP 409 with `{ version_invalidated: true, from, to,
696
+ * quote_page_url, message }`. The widget shows a restart modal.
697
+ *
698
+ * See concepts/Quote Intent Version Lifecycle in the brain wiki.
699
+ */
700
+ VERSION_INVALIDATED = "VERSION_INVALIDATED"
701
+ }
702
+ /**
703
+ * Detail payload attached to a VERSION_INVALIDATED error so the widget's
704
+ * restart modal can render which version we're moving from/to and link
705
+ * back to the quote start page.
706
+ */
707
+ interface VersionInvalidatedDetails {
708
+ from: {
709
+ id: string;
710
+ versioned_code: string;
711
+ };
712
+ to: {
713
+ id: string;
714
+ versioned_code: string;
715
+ } | null;
716
+ quote_page_url: string | null;
688
717
  }
689
718
  /**
690
719
  * Public contact details for the insurer that owns the current widget
@@ -707,7 +736,8 @@ declare class InsureOSError extends Error {
707
736
  retryAfter?: string | undefined;
708
737
  validationErrors?: Record<string, any> | undefined;
709
738
  organisation?: (ErrorOrganisation | null) | undefined;
710
- constructor(type: ErrorType, message: string, retryable?: boolean, statusCode?: number | undefined, retryAfter?: string | undefined, validationErrors?: Record<string, any> | undefined, organisation?: (ErrorOrganisation | null) | undefined);
739
+ versionInvalidated?: (VersionInvalidatedDetails | null) | undefined;
740
+ constructor(type: ErrorType, message: string, retryable?: boolean, statusCode?: number | undefined, retryAfter?: string | undefined, validationErrors?: Record<string, any> | undefined, organisation?: (ErrorOrganisation | null) | undefined, versionInvalidated?: (VersionInvalidatedDetails | null) | undefined);
711
741
  }
712
742
  /**
713
743
  * Error handling strategy for different error types
@@ -952,7 +982,7 @@ declare function parseServerValidationErrors(response: ServerValidationResponse
952
982
  */
953
983
  declare function groupErrorsByField(errors: ValidationError[]): Record<string, ValidationError[]>;
954
984
 
955
- type AppErrorType = "initialization" | "calculation" | "network" | "validation" | "maintenance" | "unknown";
985
+ type AppErrorType = "initialization" | "calculation" | "network" | "validation" | "maintenance" | "version_invalidated" | "unknown";
956
986
  type AppErrorSeverity = "warning" | "error" | "critical";
957
987
  /**
958
988
  * Public insurer contact info forwarded by the engine on 503 responses so