@splpi/estore-shared-components 7.0.2 → 7.0.3

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.mts CHANGED
@@ -170,6 +170,64 @@ type OcrSection = "personal" | "address";
170
170
  declare const readOcrResult: (section: OcrSection) => IOcrValue | null;
171
171
  /** Marks the OCR result as used for this section. Returns true the first time only. */
172
172
  declare const markOcrApplied: (section: OcrSection) => boolean;
173
+ /** Saves a fresh OCR result (clears any "applied" flags from a previous scan). */
174
+ declare const saveOcrResult: (value: IOcrValue) => void;
175
+ /** Removes the saved OCR result. */
176
+ declare const clearOcrResult: () => void;
177
+
178
+ /** The host app's ID scanner, e.g. `OcrService.scanId`. */
179
+ type ScanIdFn = (file: File) => Promise<IOcrValue>;
180
+ /**
181
+ * Wraps the host app's ID scanner and saves the result so the
182
+ * Life Plan Application form (Step 1 and Step 2) can autofill from it.
183
+ */
184
+ declare function useOcr(scanIdFn: ScanIdFn): {
185
+ data: IOcrValue | null;
186
+ loading: boolean;
187
+ error: string | null;
188
+ scanId: (file: File) => Promise<IOcrValue>;
189
+ };
190
+
191
+ type GetStartedNotifyType = "info" | "error";
192
+ type GetStartedProps = {
193
+ /** Host app's ID scanner, e.g. `OcrService.scanId`. The result is saved for form autofill. */
194
+ scanId: ScanIdFn;
195
+ /** Called on Skip / Continue in the Referral Agent dialog, e.g. `() => router.push("/lifeplan-application")`. */
196
+ onContinue?: () => void;
197
+ /** Shows a message to the user, e.g. `(type, msg) => toast[type](msg)`. Defaults to console. */
198
+ notify?: (type: GetStartedNotifyType, message: string) => void;
199
+ };
200
+ declare const GetStarted: ({ scanId: scanIdFn, onContinue, notify, }: GetStartedProps) => react_jsx_runtime.JSX.Element;
201
+
202
+ interface DocumentTypeConfig {
203
+ /** Unique id for this document slot. */
204
+ id: string;
205
+ /** Human-readable label shown in the card header. */
206
+ label: string;
207
+ /** Optional supporting description under the label. */
208
+ description?: string;
209
+ /** Comma-separated accept string, e.g. "image/png,image/jpeg,.pdf". */
210
+ accept: string;
211
+ /** Maximum allowed file size in megabytes. */
212
+ maxSizeMB: number;
213
+ /** Whether the document is required for submission. */
214
+ required?: boolean;
215
+ /** Short hint shown inside the dropzone. */
216
+ hint?: string;
217
+ /** Which AI processor handles this doc — affects completed-state copy. */
218
+ processor?: "signature" | "extraction" | string;
219
+ /** Icon component (from react-icons) rendered in the header. */
220
+ icon: React$1.ElementType;
221
+ }
222
+ type DocumentStatus = "idle" | "uploading" | "processing" | "completed" | "failed";
223
+ declare function DocumentUploadCard({ config, onStatusChange, onProcess, onError, }: {
224
+ config: DocumentTypeConfig;
225
+ /** Tells the parent when this slot's upload status changes. */
226
+ onStatusChange?: (status: DocumentStatus) => void;
227
+ onProcess?: (file: File) => Promise<unknown>;
228
+ /** Shows an error message (e.g. the host app's toast). Defaults to console.error. */
229
+ onError?: (message: string) => void;
230
+ }): react_jsx_runtime.JSX.Element;
173
231
 
174
232
  type QuickAction = {
175
233
  /** React Icons icon component */
@@ -257,4 +315,4 @@ declare const createEmptyApplicationData: () => IApplicationData;
257
315
  declare const loadApplicationDataFromLocalStorage: (storageKey?: string) => IApplicationData | null;
258
316
  declare const saveApplicationDataToLocalStorage: (data: IApplicationData, storageKey?: string) => void;
259
317
 
260
- export { Beneficiary, type BeneficiaryClass, BottomQuickActions, type CartItem, HealthDeclaration, type IAddress, type IApplicationData, type IBeneficiary, type IEmployment, type IHealthDeclaration, type IOcrValue, type IParsedAddress, type IPersonalInfo, type ITransactionData, LifePlanApplication1, LifePlanApplication2, LifePlanApplication3, LifePlanApplicationFormWrapper, LifePlanApplicationStepWrapper, type NavOptionDef, type NewSalesCheckoutItem, type NewSalesCheckoutRequest, NotifyInstall, OCR_STORAGE_KEY, type OcrSection, type ProfileUser, type ReusableProfileProps, SharedLifePlanApplication, type SharedLifePlanApplicationProps, ReusableProfile as UserProfile, createEmptyApplicationData, loadApplicationDataFromLocalStorage, markOcrApplied, readOcrResult, saveApplicationDataToLocalStorage };
318
+ export { Beneficiary, type BeneficiaryClass, BottomQuickActions, type CartItem, type DocumentStatus, type DocumentTypeConfig, DocumentUploadCard, GetStarted, type GetStartedNotifyType, type GetStartedProps, HealthDeclaration, type IAddress, type IApplicationData, type IBeneficiary, type IEmployment, type IHealthDeclaration, type IOcrValue, type IParsedAddress, type IPersonalInfo, type ITransactionData, LifePlanApplication1, LifePlanApplication2, LifePlanApplication3, LifePlanApplicationFormWrapper, LifePlanApplicationStepWrapper, type NavOptionDef, type NewSalesCheckoutItem, type NewSalesCheckoutRequest, NotifyInstall, OCR_STORAGE_KEY, type OcrSection, type ProfileUser, type ReusableProfileProps, type ScanIdFn, SharedLifePlanApplication, type SharedLifePlanApplicationProps, ReusableProfile as UserProfile, clearOcrResult, createEmptyApplicationData, loadApplicationDataFromLocalStorage, markOcrApplied, readOcrResult, saveApplicationDataToLocalStorage, saveOcrResult, useOcr };
package/dist/index.d.ts CHANGED
@@ -170,6 +170,64 @@ type OcrSection = "personal" | "address";
170
170
  declare const readOcrResult: (section: OcrSection) => IOcrValue | null;
171
171
  /** Marks the OCR result as used for this section. Returns true the first time only. */
172
172
  declare const markOcrApplied: (section: OcrSection) => boolean;
173
+ /** Saves a fresh OCR result (clears any "applied" flags from a previous scan). */
174
+ declare const saveOcrResult: (value: IOcrValue) => void;
175
+ /** Removes the saved OCR result. */
176
+ declare const clearOcrResult: () => void;
177
+
178
+ /** The host app's ID scanner, e.g. `OcrService.scanId`. */
179
+ type ScanIdFn = (file: File) => Promise<IOcrValue>;
180
+ /**
181
+ * Wraps the host app's ID scanner and saves the result so the
182
+ * Life Plan Application form (Step 1 and Step 2) can autofill from it.
183
+ */
184
+ declare function useOcr(scanIdFn: ScanIdFn): {
185
+ data: IOcrValue | null;
186
+ loading: boolean;
187
+ error: string | null;
188
+ scanId: (file: File) => Promise<IOcrValue>;
189
+ };
190
+
191
+ type GetStartedNotifyType = "info" | "error";
192
+ type GetStartedProps = {
193
+ /** Host app's ID scanner, e.g. `OcrService.scanId`. The result is saved for form autofill. */
194
+ scanId: ScanIdFn;
195
+ /** Called on Skip / Continue in the Referral Agent dialog, e.g. `() => router.push("/lifeplan-application")`. */
196
+ onContinue?: () => void;
197
+ /** Shows a message to the user, e.g. `(type, msg) => toast[type](msg)`. Defaults to console. */
198
+ notify?: (type: GetStartedNotifyType, message: string) => void;
199
+ };
200
+ declare const GetStarted: ({ scanId: scanIdFn, onContinue, notify, }: GetStartedProps) => react_jsx_runtime.JSX.Element;
201
+
202
+ interface DocumentTypeConfig {
203
+ /** Unique id for this document slot. */
204
+ id: string;
205
+ /** Human-readable label shown in the card header. */
206
+ label: string;
207
+ /** Optional supporting description under the label. */
208
+ description?: string;
209
+ /** Comma-separated accept string, e.g. "image/png,image/jpeg,.pdf". */
210
+ accept: string;
211
+ /** Maximum allowed file size in megabytes. */
212
+ maxSizeMB: number;
213
+ /** Whether the document is required for submission. */
214
+ required?: boolean;
215
+ /** Short hint shown inside the dropzone. */
216
+ hint?: string;
217
+ /** Which AI processor handles this doc — affects completed-state copy. */
218
+ processor?: "signature" | "extraction" | string;
219
+ /** Icon component (from react-icons) rendered in the header. */
220
+ icon: React$1.ElementType;
221
+ }
222
+ type DocumentStatus = "idle" | "uploading" | "processing" | "completed" | "failed";
223
+ declare function DocumentUploadCard({ config, onStatusChange, onProcess, onError, }: {
224
+ config: DocumentTypeConfig;
225
+ /** Tells the parent when this slot's upload status changes. */
226
+ onStatusChange?: (status: DocumentStatus) => void;
227
+ onProcess?: (file: File) => Promise<unknown>;
228
+ /** Shows an error message (e.g. the host app's toast). Defaults to console.error. */
229
+ onError?: (message: string) => void;
230
+ }): react_jsx_runtime.JSX.Element;
173
231
 
174
232
  type QuickAction = {
175
233
  /** React Icons icon component */
@@ -257,4 +315,4 @@ declare const createEmptyApplicationData: () => IApplicationData;
257
315
  declare const loadApplicationDataFromLocalStorage: (storageKey?: string) => IApplicationData | null;
258
316
  declare const saveApplicationDataToLocalStorage: (data: IApplicationData, storageKey?: string) => void;
259
317
 
260
- export { Beneficiary, type BeneficiaryClass, BottomQuickActions, type CartItem, HealthDeclaration, type IAddress, type IApplicationData, type IBeneficiary, type IEmployment, type IHealthDeclaration, type IOcrValue, type IParsedAddress, type IPersonalInfo, type ITransactionData, LifePlanApplication1, LifePlanApplication2, LifePlanApplication3, LifePlanApplicationFormWrapper, LifePlanApplicationStepWrapper, type NavOptionDef, type NewSalesCheckoutItem, type NewSalesCheckoutRequest, NotifyInstall, OCR_STORAGE_KEY, type OcrSection, type ProfileUser, type ReusableProfileProps, SharedLifePlanApplication, type SharedLifePlanApplicationProps, ReusableProfile as UserProfile, createEmptyApplicationData, loadApplicationDataFromLocalStorage, markOcrApplied, readOcrResult, saveApplicationDataToLocalStorage };
318
+ export { Beneficiary, type BeneficiaryClass, BottomQuickActions, type CartItem, type DocumentStatus, type DocumentTypeConfig, DocumentUploadCard, GetStarted, type GetStartedNotifyType, type GetStartedProps, HealthDeclaration, type IAddress, type IApplicationData, type IBeneficiary, type IEmployment, type IHealthDeclaration, type IOcrValue, type IParsedAddress, type IPersonalInfo, type ITransactionData, LifePlanApplication1, LifePlanApplication2, LifePlanApplication3, LifePlanApplicationFormWrapper, LifePlanApplicationStepWrapper, type NavOptionDef, type NewSalesCheckoutItem, type NewSalesCheckoutRequest, NotifyInstall, OCR_STORAGE_KEY, type OcrSection, type ProfileUser, type ReusableProfileProps, type ScanIdFn, SharedLifePlanApplication, type SharedLifePlanApplicationProps, ReusableProfile as UserProfile, clearOcrResult, createEmptyApplicationData, loadApplicationDataFromLocalStorage, markOcrApplied, readOcrResult, saveApplicationDataToLocalStorage, saveOcrResult, useOcr };