@outmarket-ai/react-sdk 0.6.0 → 0.7.0-alpha.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # @outmarket-ai/react-sdk
2
2
 
3
3
  Embed Outmarket in your React app: the workflow catalog, each workflow's form and its
4
- conversation, and the Vault, signed in as your user.
4
+ conversation, the Vault and the Endorsement Check, signed in as your user.
5
5
 
6
6
  For a minimal working app, see [Outmarket-AI/react-sdk-example](https://github.com/Outmarket-AI/react-sdk-example).
7
7
 
@@ -89,12 +89,52 @@ Using the SDK requires Outmarket's approval. See the `LICENSE` file in the packa
89
89
 
90
90
  Mount it once and put the components inside it.
91
91
 
92
- | Prop | Type | Description |
93
- | ----------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
94
- | `session` | `OutmarketSession` | Required. The `201` body from step 4, unchanged. |
95
- | `onReady` | `({ workflowsByModule, features }) => void` | Called once the user's workflows have loaded, and again if they change. `workflowsByModule`: the workflows the components can show, grouped by module, minus any your plan doesn't include. `features.vault`: whether the user can open the Vault. |
96
- | `colorMode` | `'light' \| 'dark' \| 'system'` | Color mode of the components. |
97
- | `theme` | `{ primary?: string }` | Your brand color, as hex. |
92
+ | Prop | Type | Description |
93
+ | ----------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
94
+ | `session` | `OutmarketSession` | Required. The `201` body from step 4, unchanged. |
95
+ | `onReady` | `({ workflowsByModule, features }) => void` | Called once the user's workflows have loaded, and again if they change. `workflowsByModule`: the workflows the components can show, grouped by module, minus any your plan doesn't include. `features.vault`: whether the user can open the Vault. `features.endorsementCheck`: whether the user can open the Endorsement Check. `features.events`: whether the loaded components call `onEvent`. |
96
+ | `onEvent` | `(event: OutmarketEvent) => void` | Called once for each usage event. See [Usage events](#usage-events). |
97
+ | `colorMode` | `'light' \| 'dark' \| 'system'` | Color mode of the components. |
98
+ | `theme` | `{ primary?: string }` | Your brand color, as hex. |
99
+
100
+ ### Usage events
101
+
102
+ Pass `onEvent` to `<OutmarketProvider>` to receive what users do in the components, for your
103
+ own analytics. Each event is a small object:
104
+
105
+ ```ts
106
+ interface OutmarketEvent {
107
+ name: string; // e.g. 'workflow_run_started'
108
+ timestamp: number; // epoch milliseconds, browser clock
109
+ properties: Readonly<Record<string, string | number | boolean | readonly string[]>>;
110
+ }
111
+ ```
112
+
113
+ - Only allow-listed events arrive. New event names and new properties can arrive with a
114
+ component update, with no new npm version: ignore names and keys you do not know. A
115
+ shipped event never loses or renames a property.
116
+ - Properties hold only ids of conversations (`conversation_id`), workflow codes
117
+ (`workflow_code`: a module code, or `custom_workflow` for a workflow your account made),
118
+ enums, counts, durations (`_ms`) and booleans. Never a user id, an email, a name, a file or
119
+ folder name, a path or message text: your page already knows who is signed in.
120
+ - `onEvent` is called in order, and synchronously once the user has loaded. Events sent before
121
+ that wait, then arrive in order. Keep it fast and queue slow work. A throw, or a
122
+ rejected promise from an async `onEvent`, is caught and logged once; the components keep working and the next event still arrives.
123
+ - One page has one event stream. With several providers, the newest mounted provider that
124
+ has `onEvent` gets the events of every component on the page. When it unmounts, the
125
+ provider mounted before it gets them again.
126
+ - A run's start and end events pair through `conversation_id`. A run can have no end
127
+ event, for example when the page reloads during the run.
128
+ - An older component version ignores `onEvent`. Check `features.events` in `onReady`.
129
+ - This is data minimisation, not a security boundary: the components run in your page.
130
+ - The SDK runtime reads Outmarket's PostHog key from Outmarket's CDN, published by CI from Secret
131
+ Manager. With a key, the embed sends each plan event to Outmarket's PostHog and to `onEvent`. It sends to PostHog also when you pass no `onEvent`. That PostHog is internal to
132
+ Outmarket: you never read it, and you get the events only through `onEvent`. It keeps its state
133
+ in memory only (no cookie, no `localStorage`), sends no browser page view, click or URL of your
134
+ page (the only views are the component screen events in the event list), uses its own
135
+ PostHog instance (never `window.posthog`), and sends nothing while a user is impersonated.
136
+ If your page blocks PostHog, the components and `onEvent` keep working.
137
+ The events and their properties are in [Event list](#event-list).
98
138
 
99
139
  ### Components
100
140
 
@@ -102,11 +142,14 @@ Mount it once and put the components inside it.
102
142
  | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
143
  | `OutmarketWorkflowsList` | `module`: `'commercial_lines'`, `'personal_lines'` or `'benefits'`. `onSelectWorkflow(workflowId)`: called when the user picks a workflow. |
104
144
  | `OutmarketWorkflowForm` | `workflowId`. `onConversationCreated(conversationId)`: called when the user runs the workflow. |
105
- | `OutmarketWorkflowConversation` | `conversationId`. |
145
+ | `OutmarketWorkflowConversation` | `conversationId`. `onRunStateChange(state, conversationId)`: called when the run starts (`'running'`), completes (`'complete'`) or fails (`'failed'`); on change only. |
106
146
  | `OutmarketWorkflowHistory` | One scope: `workflowId` for one workflow's past runs, `module` (`'commercial_lines'`, `'personal_lines'` or `'benefits'`) for the runs of that module's workflows, or `vault` for the user's past Vault chats (see [Past chats](#past-chats)). Without one it shows "History unavailable". `onSelectConversation(conversationId)`: called when the user opens a past run or chat. |
107
147
  | `OutmarketVault` | All optional. `location`: `{ tab: 'my' \| 'shared' \| 'team', path }`. `onLocationChange(location)`: called when the user opens a folder or switches tab. `onOpenConversation(conversationId)`: called when the user starts a chat. See [The Vault](#the-vault). |
148
+ | `OutmarketEndorsementCheck` | All optional. `conversationId`: the check to show, or `null` for the intake. `onConversationChange(conversationId)`: called when the user starts a check, opens a past one, or goes back to the intake (`null`). `onCancel()`: called when the user cancels the intake. See [The Endorsement Check](#the-endorsement-check). |
108
149
 
109
- The SDK has no routing: your app decides what to show after each callback.
150
+ The SDK has no routing between components: your app decides what to show after each callback.
151
+ Within one component, such as the Endorsement Check going from its intake to a check, the component
152
+ moves by itself and tells you where it is.
110
153
 
111
154
  ### The Vault
112
155
 
@@ -242,6 +285,227 @@ Word, PowerPoint and `.xls` files preview in an iframe from Microsoft's Office v
242
285
  `https://view.officeapps.live.com`, whose servers load the file from a link to show it. Other files,
243
286
  `.xlsx` included, preview without it.
244
287
 
288
+ ### The Endorsement Check
289
+
290
+ `<OutmarketEndorsementCheck>` is Outmarket's Endorsement Check: it compares a carrier's endorsement
291
+ with the change request it answers, the prior policy and the policy in Applied Epic. The user picks
292
+ an account, a policy, the activity and its change request, then uploads the carrier's endorsement.
293
+ Their past checks sit beside the intake, with search and a status filter. Each check shows its
294
+ progress, then its report and the actions on each finding, as in Outmarket, and the next round when
295
+ the carrier sends another endorsement. The breadcrumb row above it names the check and, once a
296
+ check has more than one round, holds the round picker.
297
+
298
+ - **Offer it only when `features.endorsementCheck` is true** (from `onReady`). Otherwise your
299
+ workspace or plan doesn't include it for this user, and the component shows "Endorsement Check
300
+ unavailable".
301
+ - **It needs Applied Epic.** In a workspace without the Applied Epic connection, or for a user who
302
+ isn't on Epic, the intake says "Endorsement Check requires Applied Epic". Past checks still open.
303
+ - **Give it a bounded height**, as the Vault: give its parent a height, or make the parent a flex
304
+ item with `flex: 1; min-height: 0` in a container that has a height.
305
+
306
+ #### Keep the check in your URL
307
+
308
+ The component never touches your page's URL or history. To keep the open check there, so a reload
309
+ or a link opens it and the browser's Back button returns to the intake, store what
310
+ `onConversationChange` reports and pass it back as `conversationId`:
311
+
312
+ ```tsx
313
+ import { useEffect, useState } from 'react';
314
+ import { OutmarketEndorsementCheck } from '@outmarket-ai/react-sdk';
315
+
316
+ // The check in this page's URL (?check=<id>), or null for the intake.
317
+ function readCheck(): string | null {
318
+ // Server rendering has no URL; the provider renders only its spinner there.
319
+ if (typeof window === 'undefined') return null;
320
+ return new URLSearchParams(window.location.search).get('check');
321
+ }
322
+
323
+ export function EndorsementCheck({ onClose }: { onClose: () => void }) {
324
+ const [conversationId, setConversationId] = useState(readCheck);
325
+
326
+ // Back and Forward: hand the URL's check to the component.
327
+ useEffect(() => {
328
+ const onPopState = () => setConversationId(readCheck());
329
+ window.addEventListener('popstate', onPopState);
330
+ return () => window.removeEventListener('popstate', onPopState);
331
+ }, []);
332
+
333
+ return (
334
+ <div style={{ height: 700 }}>
335
+ <OutmarketEndorsementCheck
336
+ conversationId={conversationId}
337
+ onConversationChange={(next) => {
338
+ setConversationId(next);
339
+ const url = new URL(window.location.href);
340
+ if (next) url.searchParams.set('check', next);
341
+ else url.searchParams.delete('check');
342
+ window.history.pushState(null, '', url);
343
+ }}
344
+ onCancel={onClose}
345
+ />
346
+ </div>
347
+ );
348
+ }
349
+ ```
350
+
351
+ How it treats `conversationId`:
352
+
353
+ - It reads `conversationId` when it mounts, and moves whenever it changes: a conversation id opens
354
+ that check, `null` the intake.
355
+ - Passing back the id it just reported does nothing.
356
+ - A move you cause never calls `onConversationChange`, so you push no entry during Back.
357
+ - It never waits for you: the user's move happens at once, whether or not you pass it back.
358
+ - `conversationId` going back to `undefined` does not move it. Without one when it mounts, it opens
359
+ the intake. That is why the sample reads `null`, not `undefined`, for a URL with no check.
360
+ - The round the user picks on a check is not part of it. Moving to another check, or reloading,
361
+ shows that check's latest round.
362
+ - A check this user can't open shows "Couldn't load this analysis", with a way back to the intake.
363
+
364
+ #### Cancel
365
+
366
+ The intake's Cancel calls `onCancel`: close the component or show something else. Leave it out and
367
+ Cancel starts the intake over.
368
+
369
+ #### Usage events
370
+
371
+ It sends `screen_viewed` and `screen_left` for the intake (`sdk_surface.endorsement_check_intake`)
372
+ and for each check (`sdk_surface.endorsement_check`), and `sdk_surface_unavailable_shown` in place
373
+ of the component. A screen event names the screen only: the check's id reaches you through
374
+ `onConversationChange`. The steps inside a check (a new round, an
375
+ AMS update, a carrier email) send no usage events yet.
376
+
377
+ ### Event list
378
+
379
+ The events that reach `onEvent`, with the component that sends each one. [Usage events](#usage-events) has the rules every event follows.
380
+
381
+ | Event | Component | Properties |
382
+ | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
383
+ | `workflow_selected` | `OutmarketWorkflowsList` | `workflow_code`, `was_search_active` (optional), `is_favorite` (optional) |
384
+ | `workflow_favorite_set` | `OutmarketWorkflowsList` | `workflow_code`, `is_favorite`, `favorites_count` |
385
+ | `workflow_start_mode_selected` | `OutmarketWorkflowForm` | `workflow_code`, `start_mode` (`documents`, `benefitpoint`, `market`) |
386
+ | `workflow_run_started` | `OutmarketWorkflowForm` | `conversation_id`, `workflow_code`, `start_mode` (`documents`, `benefitpoint`, `market`, `coi_single`, `coi_bulk`) (optional), `documents_count` (optional), `vault_documents_count` (optional), `file_kinds` (optional), `filled_fields_count` (optional), `has_additional_context` (optional), `was_saved_prompt_used` (optional), `was_prefilled` (optional), `plans_count` (optional), `launch_surface` (`workflow_page`, `first_run_guide`, `account`) (optional), `pages_count` (optional) |
387
+ | `workflow_run_start_failed` | `OutmarketWorkflowForm` | `workflow_code`, `failure_kind` |
388
+ | `workflow_input_document_added` | `OutmarketWorkflowForm` | `workflow_code`, `file_source` (`computer`, `vault`, `ams`, `cloud_drive`, `mixed`, `epic`, `imageright`, `nexsure`, `hawksoft`, `ams360`, `sagitta`, `qqcatalyst`, `google_drive`, `onedrive`), `vault_tab` (`my`, `shared`, `team`) (optional), `add_method` (`drop`, `browse`, `picker`) (optional), `documents_count`, `file_kinds`, `is_required_input` |
389
+ | `workflow_input_document_removed` | `OutmarketWorkflowForm` | `workflow_code`, `documents_count`, `removed_via` (`file_list`, `vault_picker`, `delete_all`, `failed_files`) |
390
+ | `workflow_input_document_blocked` | `OutmarketWorkflowForm` | `workflow_code`, `block_reason` (`file_type_unsupported`, `file_limit_reached`, `page_budget_exceeded`), `documents_count` |
391
+ | `workflow_input_duplicate_selected` | `OutmarketWorkflowForm` | `workflow_code`, `duplicate_choice` |
392
+ | `workflow_input_pdf_pages_selected` | `OutmarketWorkflowForm` | `workflow_code`, `pages_count` |
393
+ | `workflow_input_preference_applied` | `OutmarketWorkflowForm` | `workflow_code`, `preference_level` |
394
+ | `workflow_input_extraction_completed` | `OutmarketWorkflowForm` | `workflow_code` |
395
+ | `workflow_input_extraction_failed` | `OutmarketWorkflowForm` | `workflow_code`, `failure_kind` |
396
+ | `saved_prompt_applied` | `OutmarketWorkflowForm`, `OutmarketWorkflowConversation` | `surface`, `apply_source`, `prompt_level`, `workflow_code` (optional), `conversation_id` (optional) |
397
+ | `saved_prompt_library_opened` | `OutmarketWorkflowForm`, `OutmarketWorkflowConversation` | `surface` (`workflow_form`, `chat_composer`), `workflow_code` (optional), `conversation_id` (optional) |
398
+ | `saved_prompt_created` | `OutmarketWorkflowForm`, `OutmarketWorkflowConversation` | `create_source`, `prompt_level`, `tags_count`, `locations_count` |
399
+ | `saved_prompt_updated` | `OutmarketWorkflowForm`, `OutmarketWorkflowConversation` | `prompt_level` (`user`, `org`, `team`), `tags_count` |
400
+ | `saved_prompt_deleted` | `OutmarketWorkflowForm`, `OutmarketWorkflowConversation` | `prompt_levels`, `deleted_count` |
401
+ | `saved_prompt_shared` | `OutmarketWorkflowForm`, `OutmarketWorkflowConversation` | `recipients_count` |
402
+ | `workflow_artifact_exported` | `OutmarketWorkflowConversation` | `conversation_id` (optional), `conversation_kind` (`workflow`, `vault_chat`) (optional), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `export_format` (optional), `export_destination`, `export_scope` (`artifact`, `section`, `all`) (optional), `excel_mode` (`single`, `separate`) (optional), `exported_formats` (optional), `artifacts_count` (optional), `skipped_count` (optional), `attachments_count` (optional), `orientation_mode` (`auto`, `portrait`, `landscape`) (optional), `artifact_kind` (optional), `artifact_version_count` (optional), `is_latest_version` (optional), `has_cover_page` (optional), `surface` (`workflow_export_dialog`, `workflow_artifact_html_viewer`) (optional), `pages_count` (optional), `slides_count` (optional), `has_table_of_contents` (optional), `has_header_footer` (optional), `page_issues_count` (optional), `wait_ms` (optional), `custom_view` (`benefit_cost_analysis`, `self_funded_cost_analysis`, `contribution_analysis`, `renewal_planning`, `bill_reconciliation`, `bill_audit`, `census_comparison`, `sov_comparison`, `quote_comparer`) (optional) |
403
+ | `workflow_artifact_export_failed` | `OutmarketWorkflowConversation` | `conversation_id` (optional), `conversation_kind` (`workflow`, `vault_chat`) (optional), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `artifact_kind` (optional), `export_format`, `export_destination` (optional), `export_scope` (`artifact`, `section`, `all`) (optional), `surface` (optional), `failure_kind`, `wait_ms` (optional), `custom_view` (`benefit_cost_analysis`, `self_funded_cost_analysis`, `contribution_analysis`, `renewal_planning`, `bill_reconciliation`, `bill_audit`, `census_comparison`, `sov_comparison`, `quote_comparer`) (optional) |
404
+ | `workflow_artifact_selected` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `artifact_kind`, `open_via` (`chat_card`, `artifacts_list`, `tab`, `auto`), `artifacts_count`, `artifact_version_count` (optional), `is_latest_version` (optional) |
405
+ | `workflow_artifact_email_sent` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `recipients_count`, `has_cc`, `attachments_count` |
406
+ | `workflow_artifact_email_send_failed` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `failure_kind` |
407
+ | `workflow_artifact_export_started` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `export_format` (`pdf`, `docx`, `html`, `pptx`, `xlsx`, `csv`, `zip`) (optional), `export_destination` (`download`, `email`, `vault`, `epic`, `ams`, `google_drive`, `onedrive`, `template`, `account`, `imageright`, `nexsure`, `hawksoft`, `ams360`, `sagitta`, `qqcatalyst`), `export_scope` (`artifact`, `section`, `all`, `message`) (optional), `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`) (optional), `custom_view` (`benefit_cost_analysis`, `self_funded_cost_analysis`, `contribution_analysis`, `renewal_planning`, `bill_reconciliation`, `bill_audit`, `census_comparison`, `sov_comparison`, `quote_comparer`) (optional) |
408
+ | `workflow_artifact_export_opened` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `open_mode` (`download`, `preview`) |
409
+ | `workflow_artifact_feedback_submitted` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `artifact_kind` (optional), `feedback_kind` (`like`, `dislike`), `reasons_count`, `feedback_reasons` (optional), `has_comment` |
410
+ | `workflow_artifact_copied` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `artifact_kind` (optional), `copy_scope` (`artifact`, `section`) (optional), `custom_view` (`benefit_cost_analysis`, `self_funded_cost_analysis`, `contribution_analysis`, `renewal_planning`, `bill_reconciliation`, `bill_audit`, `census_comparison`, `sov_comparison`, `quote_comparer`) (optional), `plans_count` (optional) |
411
+ | `workflow_coi_decision_set` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `decision` (`approve`, `override`, `block`) |
412
+ | `workflow_coi_certificate_created` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional) |
413
+ | `workflow_run_completed` | `OutmarketWorkflowConversation` | `conversation_id`, `workflow_code`, `duration_ms` (optional) |
414
+ | `workflow_run_failed` | `OutmarketWorkflowConversation` | `conversation_id`, `workflow_code`, `failure_kind`, `duration_ms` (optional), `failure_stage` (`input_processing`, `extraction`, `generation`, `unknown`) (optional) |
415
+ | `workflow_run_cancelled` | `OutmarketWorkflowConversation` | `conversation_id`, `workflow_code` |
416
+ | `workflow_run_input_failed` | `OutmarketWorkflowConversation` | `conversation_id`, `workflow_code`, `failure_kind`, `failed_count` |
417
+ | `workflow_run_retry_started` | `OutmarketWorkflowConversation` | `conversation_id`, `workflow_code` |
418
+ | `workflow_conversation_opened` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional) |
419
+ | `workflow_conversation_message_added` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `prompt_origin` (optional), `attachments_count` (optional), `mentions_count` (optional), `was_dictated` (optional), `message_length` (optional), `is_first_message` (optional), `suggestion_position` (optional), `suggestions_count` (optional), `citations_count` (optional), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `conversation_age_days` (optional) |
420
+ | `workflow_conversation_message_cancelled` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `is_first_turn` |
421
+ | `workflow_conversation_message_failed` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `failure_kind` |
422
+ | `workflow_conversation_files_added` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `conversation_age_days` (optional), `file_source` (`computer`, `vault`, `ams`, `cloud_drive`, `mixed`, `epic`, `imageright`, `nexsure`, `hawksoft`, `ams360`, `sagitta`, `qqcatalyst`, `google_drive`, `onedrive`), `vault_tab` (`my`, `shared`, `team`) (optional), `add_method` (`drop`, `browse`, `paste`, `picker`), `files_count`, `file_kinds` |
423
+ | `workflow_conversation_message_copied` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional) |
424
+ | `workflow_conversation_message_feedback_submitted` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `feedback_kind` (`like`, `dislike`), `reasons_count`, `feedback_reasons` (optional), `has_comment` |
425
+ | `workflow_conversation_message_exported` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `export_format` (`pdf`, `docx`, `xlsx`), `export_destination` (`download`) |
426
+ | `workflow_panel_resized` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `panel` (`chat`), `width_bucket` (`narrow`, `medium`, `wide`) |
427
+ | `workflow_citation_opened` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `citation_surface` (`chat_message`, `artifact`, `html_artifact`), `source_kind`, `has_page`, `was_converted` |
428
+ | `workflow_citation_open_failed` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `citation_surface` (`chat_message`, `artifact`, `html_artifact`), `failure_kind` |
429
+ | `workflow_draft_created` | `OutmarketWorkflowConversation` | `conversation_id`, `draft_source` |
430
+ | `workflow_draft_create_failed` | `OutmarketWorkflowConversation` | `conversation_id`, `draft_source`, `failure_kind` |
431
+ | `workflow_source_file_exported` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `export_format` (`pdf`) |
432
+ | `workflow_conversation_selected` | `OutmarketWorkflowHistory` | `conversation_id`, `workflow_code` (optional) |
433
+ | `workflow_conversation_deleted` | `OutmarketWorkflowHistory` | `conversation_id`, `was_running` (optional) |
434
+ | `workflow_conversation_renamed` | `OutmarketWorkflowHistory` | `conversation_id` |
435
+ | `workflow_conversation_rename_failed` | `OutmarketWorkflowHistory` | `conversation_id`, `failure_kind` |
436
+ | `workflow_conversation_delete_failed` | `OutmarketWorkflowHistory` | `conversation_id`, `failure_kind` |
437
+ | `workflow_conversation_shared` | `OutmarketWorkflowHistory` | `conversation_id`, `recipients_added_count`, `edit_recipients_count`, `view_recipients_count` (optional), `team_recipients_count` (optional) |
438
+ | `workflow_conversation_share_blocked` | `OutmarketWorkflowHistory` | `conversation_id`, `block_reason` (`plan_missing_teams`) |
439
+ | `workflow_conversation_owner_set` | `OutmarketWorkflowHistory` | `conversation_id` |
440
+ | `workflow_history_empty_shown` | `OutmarketWorkflowHistory` | `history_scope` (`workflow`, `module`, `vault`), `duration_ms` |
441
+ | `workflow_history_load_failed` | `OutmarketWorkflowHistory` | `history_scope` (`workflow`, `module`, `vault`), `failure_kind` |
442
+ | `workflow_conversation_created` | `OutmarketVault` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `documents_count` (optional), `folders_count` (optional) |
443
+ | `workflow_conversation_create_failed` | `OutmarketVault` | `conversation_kind` (`workflow`, `vault_chat`), `failure_kind` |
444
+ | `workflow_artifact_opened` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `viewer_host` (`policy_checking`, `workflows`, `agent_tool`, `coi`, `extraction`, `assistant`, `risk_ai`, `document_builder`, `experts`, `insights_reports`, `vault`, `unknown`), `was_streamed`, `has_page_style`, `is_latest_version` (optional), `can_edit` |
445
+ | `workflow_artifact_edit_started` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `stored_changes_count` |
446
+ | `workflow_artifact_ai_edit_started` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `attachments_count`, `attachment_kinds` (`artifact_element`, `artifact_section`, `artifact_elements`, `artifact_text`, `artifact_table_part`, `artifact_document`) |
447
+ | `workflow_artifact_ai_edit_completed` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `ai_changes_count`, `ai_changes_received_count`, `was_deferred`, `wait_ms` (optional) |
448
+ | `workflow_artifact_ai_edit_failed` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `failure_kind` (`network`, `http_4xx`, `http_5xx`, `timeout`, `validation`, `rejected`, `unknown`, `invalid_result`) |
449
+ | `workflow_artifact_ai_edit_applied` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `ai_changes_count`, `pending_ai_changes_count`, `was_accept_all` |
450
+ | `workflow_artifact_ai_edit_apply_failed` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `ai_changes_count`, `was_accept_all`, `failure_kind` (`network`, `http_4xx`, `http_5xx`, `timeout`, `validation`, `rejected`, `unknown`, `cant_apply_together`, `check_crashed`, `refused`, `apply_crashed`) |
451
+ | `workflow_artifact_ai_edit_dismissed` | `OutmarketWorkflowConversation` | `artifact_kind` (`markdown`, `html`, `file`, `email`, `dashboard`, `benefits_model`, `comparison`, `insights_report`, `acord_form`), `ai_changes_count`, `pending_ai_changes_count`, `was_dismiss_all` |
452
+ | `workflow_conversation_message_export_failed` | `OutmarketWorkflowConversation` | `conversation_id`, `conversation_kind` (`workflow`, `vault_chat`), `workflow_code` (optional), `access_role` (`owner`, `shared_edit`, `shared_view`) (optional), `export_format` (`pdf`, `docx`, `xlsx`), `export_destination` (`download`), `failure_kind` (`network`, `http_4xx`, `http_5xx`, `timeout`, `validation`, `rejected`, `unknown`) |
453
+ | `workflow_conversation_share_failed` | `OutmarketWorkflowHistory` | `conversation_id`, `failure_kind` (`network`, `http_4xx`, `http_5xx`, `timeout`, `validation`, `rejected`, `unknown`) |
454
+ | `workflow_processed_data_opened` | `OutmarketWorkflowConversation`, `OutmarketVault` | `via` (`input_panel`, `exports_list`, `search_tool_row`, `vault`), `processed_tab` (`text`, `metadata`), `conversation_id` (optional), `conversation_kind` (`workflow`, `vault_chat`) (optional) |
455
+ | `workflow_processed_data_copied` | `OutmarketWorkflowConversation` | `via` (`input_panel`, `exports_list`, `search_tool_row`), `processed_tab` (`text`, `metadata`), `conversation_id` (optional), `conversation_kind` (`workflow`, `vault_chat`) (optional) |
456
+ | `vault_folder_opened` | `OutmarketVault` | `vault_tab` |
457
+ | `vault_folder_created` | `OutmarketVault` | `vault_tab`, `is_from_template` (optional), `create_via` (optional) |
458
+ | `vault_folder_load_failed` | `OutmarketVault` | `load_part`, `vault_tab`, `failure_kind` |
459
+ | `vault_folder_load_retry_started` | `OutmarketVault` | `load_part`, `vault_tab` |
460
+ | `vault_document_opened` | `OutmarketVault` | `vault_tab`, `open_mode` (`existing_preview`, `new_preview`), `file_kind` (optional) |
461
+ | `vault_document_added` | `OutmarketVault` | `documents_count`, `failed_count`, `file_kinds`, `vault_tab`, `upload_via` (optional) |
462
+ | `vault_document_upload_failed` | `OutmarketVault` | `failed_count`, `file_kinds`, `vault_tab`, `failure_kind` |
463
+ | `vault_document_upload_skipped` | `OutmarketVault` | `documents_count`, `skip_reason`, `vault_tab` |
464
+ | `vault_document_retry_started` | `OutmarketVault` | `vault_tab` |
465
+ | `vault_document_exported` | `OutmarketVault` | `documents_count`, `folders_count`, `vault_tab`, `export_via` (optional), `export_scope` (optional) |
466
+ | `vault_document_export_started` | `OutmarketVault` | `documents_count`, `folders_count`, `vault_tab` (`myAssets`, `sharedAssets`, `teamAssets`, `myEpic`, `ams`, `googleDrive`, `oneDrive`), `export_via` (`row_action`, `context_menu`, `selection_bar`) (optional) |
467
+ | `vault_document_export_failed` | `OutmarketVault` | `documents_count`, `folders_count`, `vault_tab`, `failure_kind` |
468
+ | `vault_asset_deleted` | `OutmarketVault` | `documents_count`, `folders_count`, `vault_tab` |
469
+ | `vault_asset_delete_failed` | `OutmarketVault` | `documents_count`, `folders_count`, `vault_tab`, `failed_count`, `failure_kind` |
470
+ | `vault_asset_moved` | `OutmarketVault` | `documents_count`, `folders_count`, `vault_tab`, `move_via` (optional) |
471
+ | `vault_asset_move_failed` | `OutmarketVault` | `documents_count`, `folders_count`, `vault_tab`, `failure_kind` |
472
+ | `vault_asset_renamed` | `OutmarketVault` | `asset_kind`, `vault_tab` |
473
+ | `vault_asset_rename_failed` | `OutmarketVault` | `asset_kind` (`file`, `folder`), `vault_tab` (`myAssets`, `sharedAssets`, `teamAssets`, `myEpic`, `ams`, `googleDrive`, `oneDrive`), `failure_kind` (`network`, `http_4xx`, `http_5xx`, `timeout`, `validation`, `rejected`, `unknown`) |
474
+ | `search_performed` | `OutmarketWorkflowsList`, `OutmarketWorkflowForm`, `OutmarketWorkflowConversation`, `OutmarketWorkflowHistory`, `OutmarketVault` | `surface` (`workflow_list`, `workflow_history`, `vault_assets`, …), `query_length`, `results_count` |
475
+ | `screen_viewed` | `OutmarketWorkflowsList`, `OutmarketWorkflowForm`, `OutmarketWorkflowConversation`, `OutmarketWorkflowHistory`, `OutmarketVault`, `OutmarketEndorsementCheck` | `screen` (`sdk_surface.workflows_list`, `sdk_surface.workflow_form`, `sdk_surface.workflow_conversation`, `sdk_surface.workflow_history`, `sdk_surface.vault`, `sdk_surface.vault_preview`, `sdk_surface.endorsement_check_intake`, `sdk_surface.endorsement_check`, …) |
476
+ | `screen_left` | `OutmarketWorkflowsList`, `OutmarketWorkflowForm`, `OutmarketWorkflowConversation`, `OutmarketWorkflowHistory`, `OutmarketVault`, `OutmarketEndorsementCheck` | `screen`, `active_ms`, `visible_ms`, `wall_ms` |
477
+ | `sdk_surface_unavailable_shown` | `OutmarketWorkflowForm`, `OutmarketWorkflowConversation`, `OutmarketWorkflowHistory`, `OutmarketVault`, `OutmarketEndorsementCheck` | `unavailable_reason` (`no_scope`, `not_embeddable`, `not_in_plan`, `missing`, `module_not_enabled`, `not_found`, `access_denied`) |
478
+
479
+ - The same events fire in Outmarket's own app, so a component and the app page it wraps count
480
+ alike. The exception is `workflow_history_empty_shown`: it fires only in a component. In a component, only a workflow run or a Vault chat sends conversation events.
481
+ - A run's end event fires only when this page started the run (in `OutmarketWorkflowForm` or a
482
+ picker it shows) and an `OutmarketWorkflowConversation` shows it.
483
+ - `workflow_conversation_message_added` fires once per message the server took, when its reply
484
+ stream ends, not at the click. `prompt_origin` says where the text came from: typed, a saved
485
+ prompt, a suggestion chip, the answer to a question the workflow asked, a retry or a restored
486
+ draft. It carries `message_length` (the number of characters), never the text. A send the
487
+ server refuses fires only `workflow_conversation_message_failed`.
488
+ - `workflow_run_cancelled` fires when the user stops a run this page started and the server
489
+ accepts the stop. That run then gets no `workflow_run_completed` or `workflow_run_failed`. A
490
+ stop of the first turn also fires `workflow_conversation_message_cancelled`: never add the two.
491
+ - `*_failed` events carry `failure_kind`; an event may add its own values after the common ones.
492
+ - `search_performed` fires once per query, after the user stops typing and the results arrive.
493
+ It never carries the query text, only its length.
494
+ - `sdk_surface_unavailable_shown` fires once when a component shows its unavailable state.
495
+ - `workflow_artifact_export_started` fires once when the user confirms an export, before the file exists.
496
+ Its outcome event follows (for a text answer of the chat, `workflow_conversation_message_exported` or its
497
+ failure); a cancel after the confirm sends only the start.
498
+ - `workflow_processed_data_opened` fires when the user opens the processed data of a file, and again
499
+ each time the user changes its tab. It never carries the file name or the text.
500
+ - `screen_viewed` fires when a component mounts, and again when its view changes without a
501
+ remount: another conversation, a history of another scope, a Vault file preview coming in
502
+ front of the listing or closing, or another check (or the intake again) in the Endorsement Check. `screen_left` fires for the view it replaces and when the
503
+ component unmounts, with the time spent (`active_ms` counts only time with the tab visible and
504
+ the user active). A component inside another one, such as an artifact viewer, can send its own
505
+ screen events in between.
506
+ - `vault_asset_deleted` fires only when every selected item was deleted; a partial delete fires
507
+ `vault_asset_delete_failed` with `failure_kind` `partial`.
508
+
245
509
  ### `signOut()`
246
510
 
247
511
  Call it in your own logout, then discard the session you passed. It clears the session from your
package/dist/index.d.ts CHANGED
@@ -18,8 +18,24 @@ export interface OutmarketWorkflowInfo {
18
18
  * components can render, minus the plan-locked ones, grouped by module. */
19
19
  export interface OutmarketReadyPayload {
20
20
  workflowsByModule: Record<OutmarketModule, OutmarketWorkflowInfo[]>;
21
- /** What else the session can open. `vault`: the user has the Vault and the plan includes it. */
22
- features: { vault: boolean };
21
+ /** What else the session can open, each when the user has it and the plan includes it. `vault`: the Vault.
22
+ * `endorsementCheck`: the Endorsement Check. `events`: the loaded runtime calls `onEvent`. Each is false
23
+ * for a runtime from before it. */
24
+ features: { vault: boolean; endorsementCheck: boolean; events: boolean };
25
+ }
26
+
27
+ /** One allow-listed usage event from an Outmarket component. */
28
+ export interface OutmarketEvent {
29
+ /** Tracking-plan event name, e.g. 'workflow_run_started'. New names can arrive through
30
+ * the CDN with no npm release. Ignore names you do not know. */
31
+ name: string;
32
+ /** Epoch milliseconds (browser clock) when the action happened. */
33
+ timestamp: number;
34
+ /** Only these kinds: conversation_id, workflow_code (a module code, or 'custom_workflow'),
35
+ * enums, counts, durations (_ms), booleans. Never the Outmarket user id, email, instance id
36
+ * or name, file or folder names, paths, workflow titles, custom workflow names or message
37
+ * text. Null values are left out. Ignore keys you do not know. */
38
+ properties: Readonly<Record<string, string | number | boolean | readonly string[]>>;
23
39
  }
24
40
 
25
41
  /** Friendly title for each module. */
@@ -138,6 +154,13 @@ export interface OutmarketProviderProps {
138
154
  /** Fires once bootstrap and the user resolve, with the workflows the components
139
155
  * can render, minus the plan-locked ones, grouped by module; again if they change. */
140
156
  onReady?: (payload: OutmarketReadyPayload) => void;
157
+ /** Called once for each allow-listed usage event, in order: synchronously, except that
158
+ * events sent before the user loads wait until it does.
159
+ * Keep it fast. A throw or a rejected promise is caught and never breaks a component.
160
+ * One page has one event stream: the newest mounted provider with onEvent gets the events
161
+ * of every surface on the page, and an older one gets them again when the newer one unmounts.
162
+ * An older runtime ignores this prop: check `features.events` in onReady. */
163
+ onEvent?: (event: OutmarketEvent) => void;
141
164
  children?: ReactNode;
142
165
  }
143
166
 
@@ -191,6 +214,8 @@ export declare function OutmarketWorkflowForm(props: OutmarketWorkflowFormProps)
191
214
  /** The full conversation surface (chat, charts, artifacts, citations, PDF/source). */
192
215
  export interface OutmarketWorkflowConversationProps {
193
216
  conversationId: string;
217
+ /** Fires with this conversation's id when the run starts, completes or fails; on change only. */
218
+ onRunStateChange?: (state: 'running' | 'complete' | 'failed', conversationId: string) => void;
194
219
  }
195
220
 
196
221
  export declare function OutmarketWorkflowConversation(props: OutmarketWorkflowConversationProps): ReactNode;
@@ -252,3 +277,22 @@ export interface OutmarketVaultProps {
252
277
  onOpenConversation?: (conversationId: string) => void;
253
278
  }
254
279
  export declare function OutmarketVault(props: OutmarketVaultProps): ReactNode;
280
+
281
+ /** The full Endorsement Check: the intake (account, policy, activity, change request, then the carrier's endorsement)
282
+ * beside the user's past checks, and each check's progress, report, rounds and AMS and carrier actions. It needs the
283
+ * workspace's Applied Epic connection: without one, or for a user not on Epic, the intake says so. It fills its
284
+ * parent, which must have a bounded height. */
285
+ export interface OutmarketEndorsementCheckProps {
286
+ /** The check to show: a conversation id, or `null` for the intake. Read when it mounts, and followed whenever it
287
+ * changes: change it to move the component (your own links, browser Back). Passing back the id
288
+ * `onConversationChange` just reported does nothing, and `undefined` leaves it where it is. Omit it to open the
289
+ * intake. */
290
+ conversationId?: string | null;
291
+ /** Fires when the user starts a check (its id), opens a past one, or goes back to the intake (`null`), never for a
292
+ * move `conversationId` caused. Store it (in state, in your URL) and pass it back as `conversationId`. The
293
+ * component moves on its own and never waits for you to pass it back. */
294
+ onConversationChange?: (conversationId: string | null) => void;
295
+ /** Fires when the user presses the intake's Cancel. Omit it and Cancel starts the intake over. */
296
+ onCancel?: () => void;
297
+ }
298
+ export declare function OutmarketEndorsementCheck(props: OutmarketEndorsementCheckProps): ReactNode;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as tt,jsx as u}from"react/jsx-runtime";import{lazy as et,useState as rt,useLayoutEffect as P,useSyncExternalStore as nt,Suspense as O,useRef as ot,useCallback as it}from"react";const g="production",R=["production","qa","staging"],N={api:"NEXT_PUBLIC_API_BASE_URL",nexus:"NEXT_PUBLIC_NEXUS_BASE_URL",gateway:"NEXT_PUBLIC_GATEWAY_BASE_URL"},C={NODE_ENV:"production",NEXT_PUBLIC_PDF_WORKER_URL:"https://cdn.jsdelivr.net/npm/pdfjs-dist@4.10.38/build/pdf.worker.min.mjs"},w={production:{NEXT_PUBLIC_APP_ENV:"production",NEXT_PUBLIC_API_BASE_URL:"https://api.prod.outmarket.ai/v1",NEXT_PUBLIC_NEXUS_BASE_URL:"https://nexus.prod.outmarket.ai/api/v1",NEXT_PUBLIC_GATEWAY_BASE_URL:"https://gateway.outmarket.ai/api/v1",NEXT_PUBLIC_USE_OPTIMUS:"true",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX:"@outmarket",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY:"OYgxUAznYZZjedB08lRQ9i7BR5QaTRVF",NEXT_PUBLIC_STATSIG_CLIENT_KEY:"client-acTBiSi4StL0uGJe2dzAwS306PfF0hNLrMbYSmm3K2W"},qa:{NEXT_PUBLIC_APP_ENV:"qa",NEXT_PUBLIC_API_BASE_URL:"https://api-qa.outmarket.ai/v1",NEXT_PUBLIC_NEXUS_BASE_URL:"https://nexus-qa.outmarket.ai/api/v1",NEXT_PUBLIC_GATEWAY_BASE_URL:"https://gateway.stage.outmarket.ai/api/v1",NEXT_PUBLIC_USE_OPTIMUS:"true",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX:"@outmarket",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY:"OYgxUAznYZZjedB08lRQ9i7BR5QaTRVF",NEXT_PUBLIC_STATSIG_CLIENT_KEY:"client-acTBiSi4StL0uGJe2dzAwS306PfF0hNLrMbYSmm3K2W"},staging:{NEXT_PUBLIC_APP_ENV:"staging",NEXT_PUBLIC_API_BASE_URL:"https://api-g.stage.outmarket.ai/v1",NEXT_PUBLIC_NEXUS_BASE_URL:"https://nexus.stage.outmarket.ai/api/v1",NEXT_PUBLIC_GATEWAY_BASE_URL:"https://gateway.stage.outmarket.ai/api/v1",NEXT_PUBLIC_USE_OPTIMUS:"true",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX:"@outmarket",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY:"OYgxUAznYZZjedB08lRQ9i7BR5QaTRVF",NEXT_PUBLIC_STATSIG_CLIENT_KEY:"client-acTBiSi4StL0uGJe2dzAwS306PfF0hNLrMbYSmm3K2W"}},at={production:{...C,...w.production}},st=at.production,E="[@outmarket-ai/react-sdk]",y='an absolute http(s) URL ("https://host/path") or a root-relative path ("/path")',B="http://root-relative.invalid",ut=t=>typeof t=="string"&&R.includes(t),ct=Object.keys(N),lt=t=>ct.includes(t),b=t=>typeof t=="string"?JSON.stringify(t):t===null?"null":typeof t;function dt(t,e){try{return new URL(t,e)}catch{return null}}function ft(t){if(typeof t!="string")return{error:`expected a string, got ${b(t)}`};const e=t.trim();if(!e)return{error:"it is empty"};const r=e.startsWith("/"),o=dt(e,r?B:void 0);if(!o)return{error:`expected ${y}`};if(r&&o.origin!==B)return{error:`a path must start with a single "/" (a value starting "//" points at another host); expected ${y}`};if(!r&&o.protocol!=="http:"&&o.protocol!=="https:")return{error:`only http and https are supported; expected ${y}`};if(o.username||o.password)return{error:"it must not carry credentials"};if(e.includes("?")||e.includes("#"))return{error:"it must not carry a query or fragment"};const n=(r?e:o.href).replace(/\/+$/,"");return n?{url:n}:{error:'a bare "/" is not a base URL; include the path, e.g. "/proxy/api/v1"'}}function mt(t,e){return t===void 0||ut(t)?t??g:(e(`${E} Ignoring environment ${b(t)}: expected ${R.map(r=>`'${r}'`).join(", ")}. Using '${g}'.`),g)}function _t(t,e,r){if(t===void 0)return{};if(t===null||typeof t!="object"||Array.isArray(t))return r(`${E} Ignoring apiUrls: expected an object such as { nexus: 'https://\u2026' }.`),{};const o={};for(const[n,i]of Object.entries(t)){if(!lt(n)){r(`${E} Ignoring apiUrls.${n}: not an Outmarket API (expected api, nexus or gateway).`);continue}if(i===void 0)continue;const a=N[n],s=ft(i);if(s.url!==void 0){o[a]=s.url;continue}r(`${E} Ignoring apiUrls.${n}: ${s.error}. Using the '${e}' URL instead: ${w[e][a]}.`)}return o}function pt(t){return t===void 0?!1:t===null||typeof t!="object"||Array.isArray(t)?!0:Object.values(t).some(e=>e!==void 0)}function ht(t,e){const{environment:r,apiUrls:o}=t;if(r===void 0&&!pt(o))return{};const n=mt(r,e);return{...w[n],..._t(o,n,e)}}const v="__OM_EMBED_CONFIG__",Et="[@outmarket-ai/react-sdk]";function S(){const t=globalThis;return t[v]||(t[v]={}),t[v]}function X(){if(typeof globalThis>"u")return;const t=S();for(const[e,r]of Object.entries(st))t[e]===void 0&&r!==void 0&&(t[e]=r)}let m=null,M=!1;const x=new Set;function Ut(t){x.has(t)||(x.add(t),console.error(t))}function j(t){return JSON.stringify(Object.keys(t).sort().map(e=>[e,t[e]]))}function Lt(t){M||(M=!0,console.warn(`${Et} OutmarketProvider got an environment or apiUrls that differs from the configuration this page already uses. The SDK applies its configuration once per page load (when the first OutmarketProvider mounts, or on the first signOut() if that came first); reload the page to use the new one. Still using api ${t.NEXT_PUBLIC_API_BASE_URL}, nexus ${t.NEXT_PUBLIC_NEXUS_BASE_URL}, gateway ${t.NEXT_PUBLIC_GATEWAY_BASE_URL}.`))}function T(t){const e=ht(t,Ut),r=S();if(m===null){X();const o={...r};Object.assign(r,e),m={base:o,signature:j(r)};return}j({...m.base,...e})!==m.signature&&Lt(r)}function gt(){m===null&&T({})}X();const wt="245 84% 64%",W="14 100% 57%",A=`hsl(var(--om-primary, ${wt}))`,yt=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function vt({colorMode:t="light",theme:e}={}){var r;const o=(r=e==null?void 0:e.primary)==null?void 0:r.trim(),n=o?yt.exec(o):null;return n?`#${n[1]}`:t==="dark"?`hsl(${W})`:t==="system"?`light-dark(${A}, hsl(${W}))`:A}const Y={flex:1,minHeight:320,display:"flex",alignItems:"center",justifyContent:"center"},St={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},F=40,Tt="light dark";function G({color:t=A}){return tt("div",{role:"status","aria-live":"polite","data-testid":"om-embed-loading",style:Y,children:[u("span",{style:St,children:"Loading\u2026"}),u("svg",{"aria-hidden":"true","data-testid":"om-embed-loading-spinner",width:F,height:F,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{color:t,colorScheme:Tt},children:u("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",children:u("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"1s",repeatCount:"indefinite"})})})]})}function At(){return u("div",{role:"alert","data-testid":"om-embed-load-failed",style:{...Y,padding:16,textAlign:"center"},children:"Outmarket could not load. Check your connection and reload the page."})}const K="OM_SDK_RUNTIME_CDN_URL",kt="OM_SDK_RUNTIME_VERSION",k="https://embed.outmarket.ai/react-sdk",$t=new Set(["localhost","127.0.0.1"]);function It(t){if(typeof t!="string")return null;let e;try{e=new URL(t)}catch{return null}return!(e.protocol==="https:"||e.protocol==="http:"&&$t.has(e.hostname))||e.username||e.password||e.search||e.hash?null:`${e.origin}${e.pathname.replace(/\/+$/,"")}`}function Pt(t,e){if(t===void 0||t==="")return k;const r=It(t);return r!==null?r:(e(`[@outmarket-ai/react-sdk] Ignoring ${K} ${JSON.stringify(t)}: expected an https: URL (or http: on localhost / 127.0.0.1) without credentials, query or fragment. Using ${k}.`),k)}function Ot(t,e=console.error){const r=t[kt];return{base:Pt(t[K],e),pin:r===void 0||r===""?void 0:String(r),appEnv:t.NEXT_PUBLIC_APP_ENV}}async function D(t,{timeoutMs:e,cache:r,fetchImpl:o=globalThis.fetch}){const n=new AbortController,i=setTimeout(()=>n.abort(),e);try{let a;try{a=await o(t,{cache:r,credentials:"omit",signal:n.signal})}catch(s){throw new Error(n.signal.aborted?`${t} did not answer within ${e} ms`:`${t} could not be fetched: ${String(s)}`)}if(!a.ok)throw new Error(`${t} answered HTTP ${a.status}`);try{return await a.json()}catch{throw new Error(n.signal.aborted?`${t} did not answer within ${e} ms`:`${t} is not JSON`)}}finally{clearTimeout(i)}}async function Rt(){const[t,e,r,o,n]=await Promise.all([import("react"),import("react/jsx-runtime"),import("react-dom"),import("react-dom/client"),import("react-dom/server")]);return{react:t,"react/jsx-runtime":e,"react-dom":r,"react-dom/client":o,"react-dom/server":n}}function Nt(t){return import(/* webpackIgnore: true */ /* turbopackIgnore: true */ /* @vite-ignore */ t)}const Ct=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/,Bt=1e4;function bt(t){return t==="staging"?"alpha":t==="qa"?"beta":"stable"}function V(t,e){if(typeof t=="string"&&Ct.test(t))return t;throw new Error(`${e} is ${JSON.stringify(t)??String(t)}, not a runtime version`)}async function Xt({base:t,pin:e,appEnv:r,fetchImpl:o,timeoutMs:n=Bt}){if(e!==void 0)return V(e,"OM_SDK_RUNTIME_VERSION");const i=`${t}/versions.json`,a=await D(i,{cache:"no-cache",timeoutMs:n,fetchImpl:o});if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`${i} is not an object of versions`);const s=bt(r);return V(a[s],`${i} "${s}"`)}const H="data-om-embed-runtime",U=Symbol.for("outmarket.embed.stylesheetWaiters");function Mt(t,e){return[...e.querySelectorAll(`link[${H}]`)].find(r=>r.getAttribute("href")===t)}function xt(t,e,r){const o=Mt(t,r);if(o!=null&&o.sheet)return Promise.resolve();const n=o??r.createElement("link");return n[U]=(n[U]??0)+1,new Promise((i,a)=>{const s=l=>{clearTimeout(h),n.removeEventListener("load",d),n.removeEventListener("error",c);const f=(n[U]??1)-1;if(n[U]=f,l==="load"){i();return}(l==="error"||f===0)&&n.remove(),a(new Error(l==="error"?`${t} could not be loaded`:`${t} did not load within ${e} ms`))},d=()=>s("load"),c=()=>s("error"),h=setTimeout(()=>s("timeout"),e);n.addEventListener("load",d),n.addEventListener("error",c),o||(n.rel="stylesheet",n.href=t,n.setAttribute(H,""),r.head.appendChild(n))})}async function jt(t,e,r=document){await Promise.all(t.map(o=>xt(o,e,r)))}const z=1,Wt=()=>({fetchImpl:globalThis.fetch,loadHostReact:Rt,importModule:Nt,document,timeouts:{versionsMs:1e4,manifestMs:1e4,cssMs:3e4,entryMs:3e4}});let L;const Yt=/^[A-Za-z0-9_][A-Za-z0-9._-]*$/,$=t=>typeof t=="string"&&t.split("/").every(e=>Yt.test(e));function Ft(t,e,r){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${r} is not a runtime manifest`);const o=t;if(o.version!==e)throw new Error(`${r} is for version ${JSON.stringify(o.version)}, not ${e}`);const{entry:n,worker:i,css:a}=o;if(!$(n))throw new Error(`${r} has no valid "entry"`);if(!$(i))throw new Error(`${r} has no valid "worker"`);if(!Array.isArray(a)||!a.every($))throw new Error(`${r} has no valid "css"`);return{version:e,entry:n,worker:i,css:a}}async function Gt(t,e,r,o){const n=t==null?void 0:t.boot;if(typeof n!="function")throw new Error(`${e} does not export boot()`);const i=await n(r);if((i==null?void 0:i.contractVersion)!==z)throw new Error(`the CDN runtime ${o} implements runtime contract ${String(i==null?void 0:i.contractVersion)}; this SDK needs ${z}`);return i}async function Kt(t,e,r){const[o,n]=await Promise.all([t.loadHostReact(),t.importModule(e)]);return Gt(n,e,o,r)}function Dt(t,e,r){let o;const n=new Promise((i,a)=>{o=setTimeout(()=>a(new Error(r)),e)});return Promise.race([t,n]).finally(()=>clearTimeout(o))}async function Vt(t,e,r={}){const o={...Wt(),...r},{fetchImpl:n,timeouts:i}=o,a=await Xt({...t,fetchImpl:n,timeoutMs:i.versionsMs}),s=`${t.base}/${a}`,d=`${s}/manifest.json`,c=Ft(await D(d,{timeoutMs:i.manifestMs,fetchImpl:n}),a,d),h=jt(c.css.map(Q=>`${s}/${Q}`),i.cssMs,o.document);h.catch(()=>{});const l=e.NEXT_PUBLIC_PDF_WORKER_URL;(l===C.NEXT_PUBLIC_PDF_WORKER_URL||L!==void 0&&l===L)&&(L=`${s}/${c.worker}`,e.NEXT_PUBLIC_PDF_WORKER_URL=L);const f=`${s}/${c.entry}`,Z=await Dt(Kt(o,f,a),i.entryMs,`${f} did not load within ${i.entryMs} ms`);return await h,globalThis.__OM_EMBED__={source:"cdn",base:t.base,version:a},Z}let _=null,I=null;function q(){if(_===null){gt();const t=S();I??(I=Ot(t));const e=Vt(I,t);e.catch(()=>{_===e&&(_=null)}),_=e}return _}function J(t){return et(async()=>{try{return{default:await t(await q())}}catch(e){return console.error("[@outmarket-ai/react-sdk] Could not load the Outmarket components.",e),{default:At}}})}const Ht={vault:!1};function zt(t){return{...t,features:{...Ht,...t.features}}}function qt(t,e){const[r,o]=rt(!1);return P(()=>{T({environment:t,apiUrls:e}),o(!0)},[t,e]),r}const Jt=J(t=>t.OutmarketProviderTree),Zt=()=>()=>{},Qt=()=>!0,te=()=>!1;function ee(t){const e=ot(t);P(()=>{e.current=t});const r=it(o=>{var n;return(n=e.current)==null?void 0:n.call(e,zt(o))},[]);return t?r:void 0}function re({environment:t,apiUrls:e,...r}){const o=ee(r.onReady),n=nt(Zt,Qt,te),i=qt(t,e),a=u(G,{color:vt(r)});return!n||!i?a:u(O,{fallback:a,children:u(Jt,{...r,onReady:o})})}async function ne(t){typeof window>"u"||(t&&T({environment:t.environment,apiUrls:t.apiUrls}),await(await q()).signOut())}function p(t,e){const r=J(n=>e(n.surfaces));function o(n){return u(O,{fallback:u(G,{}),children:u(r,{...n})})}return o.displayName=t,o}const oe=p("OutmarketWorkflowsList",t=>t.OutmarketWorkflowsList()),ie=p("OutmarketWorkflowForm",t=>t.OutmarketWorkflowForm()),ae=p("OutmarketWorkflowConversation",t=>t.OutmarketWorkflowConversation()),se=p("OutmarketWorkflowHistory",t=>t.OutmarketWorkflowHistory()),ue=p("OutmarketVault",t=>t.OutmarketVault()),ce={commercial_lines:"Commercial Insurance",personal_lines:"Personal Lines",benefits:"Employee Benefits"};export{ce as MODULE_TITLE,re as OutmarketProvider,ue as OutmarketVault,ae as OutmarketWorkflowConversation,ie as OutmarketWorkflowForm,se as OutmarketWorkflowHistory,oe as OutmarketWorkflowsList,ne as signOut};
1
+ import{jsxs as tt,jsx as u}from"react/jsx-runtime";import{lazy as et,useState as rt,useLayoutEffect as P,useSyncExternalStore as nt,Suspense as O,useRef as ot,useCallback as it}from"react";const g="production",R=["production","qa","staging"],N={api:"NEXT_PUBLIC_API_BASE_URL",nexus:"NEXT_PUBLIC_NEXUS_BASE_URL",gateway:"NEXT_PUBLIC_GATEWAY_BASE_URL"},C={NODE_ENV:"production",NEXT_PUBLIC_PDF_WORKER_URL:"https://cdn.jsdelivr.net/npm/pdfjs-dist@4.10.38/build/pdf.worker.min.mjs"},w={production:{NEXT_PUBLIC_APP_ENV:"production",NEXT_PUBLIC_API_BASE_URL:"https://api.prod.outmarket.ai/v1",NEXT_PUBLIC_NEXUS_BASE_URL:"https://nexus.prod.outmarket.ai/api/v1",NEXT_PUBLIC_GATEWAY_BASE_URL:"https://gateway.outmarket.ai/api/v1",NEXT_PUBLIC_USE_OPTIMUS:"true",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX:"@outmarket",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY:"OYgxUAznYZZjedB08lRQ9i7BR5QaTRVF",NEXT_PUBLIC_STATSIG_CLIENT_KEY:"client-acTBiSi4StL0uGJe2dzAwS306PfF0hNLrMbYSmm3K2W"},qa:{NEXT_PUBLIC_APP_ENV:"qa",NEXT_PUBLIC_API_BASE_URL:"https://api-qa.outmarket.ai/v1",NEXT_PUBLIC_NEXUS_BASE_URL:"https://nexus-qa.outmarket.ai/api/v1",NEXT_PUBLIC_GATEWAY_BASE_URL:"https://gateway.stage.outmarket.ai/api/v1",NEXT_PUBLIC_USE_OPTIMUS:"true",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX:"@outmarket",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY:"OYgxUAznYZZjedB08lRQ9i7BR5QaTRVF",NEXT_PUBLIC_STATSIG_CLIENT_KEY:"client-acTBiSi4StL0uGJe2dzAwS306PfF0hNLrMbYSmm3K2W"},staging:{NEXT_PUBLIC_APP_ENV:"staging",NEXT_PUBLIC_API_BASE_URL:"https://api-g.stage.outmarket.ai/v1",NEXT_PUBLIC_NEXUS_BASE_URL:"https://nexus.stage.outmarket.ai/api/v1",NEXT_PUBLIC_GATEWAY_BASE_URL:"https://gateway.stage.outmarket.ai/api/v1",NEXT_PUBLIC_USE_OPTIMUS:"true",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX:"@outmarket",NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY:"OYgxUAznYZZjedB08lRQ9i7BR5QaTRVF",NEXT_PUBLIC_STATSIG_CLIENT_KEY:"client-acTBiSi4StL0uGJe2dzAwS306PfF0hNLrMbYSmm3K2W"}},at={production:{...C,...w.production}},st=at.production,E="[@outmarket-ai/react-sdk]",y='an absolute http(s) URL ("https://host/path") or a root-relative path ("/path")',B="http://root-relative.invalid",ut=t=>typeof t=="string"&&R.includes(t),ct=Object.keys(N),lt=t=>ct.includes(t),b=t=>typeof t=="string"?JSON.stringify(t):t===null?"null":typeof t;function dt(t,e){try{return new URL(t,e)}catch{return null}}function mt(t){if(typeof t!="string")return{error:`expected a string, got ${b(t)}`};const e=t.trim();if(!e)return{error:"it is empty"};const r=e.startsWith("/"),o=dt(e,r?B:void 0);if(!o)return{error:`expected ${y}`};if(r&&o.origin!==B)return{error:`a path must start with a single "/" (a value starting "//" points at another host); expected ${y}`};if(!r&&o.protocol!=="http:"&&o.protocol!=="https:")return{error:`only http and https are supported; expected ${y}`};if(o.username||o.password)return{error:"it must not carry credentials"};if(e.includes("?")||e.includes("#"))return{error:"it must not carry a query or fragment"};const n=(r?e:o.href).replace(/\/+$/,"");return n?{url:n}:{error:'a bare "/" is not a base URL; include the path, e.g. "/proxy/api/v1"'}}function ft(t,e){return t===void 0||ut(t)?t??g:(e(`${E} Ignoring environment ${b(t)}: expected ${R.map(r=>`'${r}'`).join(", ")}. Using '${g}'.`),g)}function _t(t,e,r){if(t===void 0)return{};if(t===null||typeof t!="object"||Array.isArray(t))return r(`${E} Ignoring apiUrls: expected an object such as { nexus: 'https://\u2026' }.`),{};const o={};for(const[n,i]of Object.entries(t)){if(!lt(n)){r(`${E} Ignoring apiUrls.${n}: not an Outmarket API (expected api, nexus or gateway).`);continue}if(i===void 0)continue;const a=N[n],s=mt(i);if(s.url!==void 0){o[a]=s.url;continue}r(`${E} Ignoring apiUrls.${n}: ${s.error}. Using the '${e}' URL instead: ${w[e][a]}.`)}return o}function pt(t){return t===void 0?!1:t===null||typeof t!="object"||Array.isArray(t)?!0:Object.values(t).some(e=>e!==void 0)}function ht(t,e){const{environment:r,apiUrls:o}=t;if(r===void 0&&!pt(o))return{};const n=ft(r,e);return{...w[n],..._t(o,n,e)}}const v="__OM_EMBED_CONFIG__",Et="[@outmarket-ai/react-sdk]";function S(){const t=globalThis;return t[v]||(t[v]={}),t[v]}function X(){if(typeof globalThis>"u")return;const t=S();for(const[e,r]of Object.entries(st))t[e]===void 0&&r!==void 0&&(t[e]=r)}let _=null,M=!1;const x=new Set;function Ut(t){x.has(t)||(x.add(t),console.error(t))}function j(t){return JSON.stringify(Object.keys(t).sort().map(e=>[e,t[e]]))}function Lt(t){M||(M=!0,console.warn(`${Et} OutmarketProvider got an environment or apiUrls that differs from the configuration this page already uses. The SDK applies its configuration once per page load (when the first OutmarketProvider mounts, or on the first signOut() if that came first); reload the page to use the new one. Still using api ${t.NEXT_PUBLIC_API_BASE_URL}, nexus ${t.NEXT_PUBLIC_NEXUS_BASE_URL}, gateway ${t.NEXT_PUBLIC_GATEWAY_BASE_URL}.`))}function T(t){const e=ht(t,Ut),r=S();if(_===null){X();const o={...r};Object.assign(r,e),_={base:o,signature:j(r)};return}j({..._.base,...e})!==_.signature&&Lt(r)}function gt(){_===null&&T({})}X();const wt="245 84% 64%",W="14 100% 57%",k=`hsl(var(--om-primary, ${wt}))`,yt=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function vt({colorMode:t="light",theme:e}={}){var r;const o=(r=e==null?void 0:e.primary)==null?void 0:r.trim(),n=o?yt.exec(o):null;return n?`#${n[1]}`:t==="dark"?`hsl(${W})`:t==="system"?`light-dark(${k}, hsl(${W}))`:k}const Y={flex:1,minHeight:320,display:"flex",alignItems:"center",justifyContent:"center"},St={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},F=40,Tt="light dark";function G({color:t=k}){return tt("div",{role:"status","aria-live":"polite","data-testid":"om-embed-loading",style:Y,children:[u("span",{style:St,children:"Loading\u2026"}),u("svg",{"aria-hidden":"true","data-testid":"om-embed-loading-spinner",width:F,height:F,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{color:t,colorScheme:Tt},children:u("path",{d:"M21 12a9 9 0 1 1-6.219-8.56",children:u("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"1s",repeatCount:"indefinite"})})})]})}function kt(){return u("div",{role:"alert","data-testid":"om-embed-load-failed",style:{...Y,padding:16,textAlign:"center"},children:"Outmarket could not load. Check your connection and reload the page."})}const K="OM_SDK_RUNTIME_CDN_URL",At="OM_SDK_RUNTIME_VERSION",A="https://embed.outmarket.ai/react-sdk",$t=new Set(["localhost","127.0.0.1"]);function It(t){if(typeof t!="string")return null;let e;try{e=new URL(t)}catch{return null}return!(e.protocol==="https:"||e.protocol==="http:"&&$t.has(e.hostname))||e.username||e.password||e.search||e.hash?null:`${e.origin}${e.pathname.replace(/\/+$/,"")}`}function Pt(t,e){if(t===void 0||t==="")return A;const r=It(t);return r!==null?r:(e(`[@outmarket-ai/react-sdk] Ignoring ${K} ${JSON.stringify(t)}: expected an https: URL (or http: on localhost / 127.0.0.1) without credentials, query or fragment. Using ${A}.`),A)}function Ot(t,e=console.error){const r=t[At];return{base:Pt(t[K],e),pin:r===void 0||r===""?void 0:String(r),appEnv:t.NEXT_PUBLIC_APP_ENV}}async function D(t,{timeoutMs:e,cache:r,fetchImpl:o=globalThis.fetch}){const n=new AbortController,i=setTimeout(()=>n.abort(),e);try{let a;try{a=await o(t,{cache:r,credentials:"omit",signal:n.signal})}catch(s){throw new Error(n.signal.aborted?`${t} did not answer within ${e} ms`:`${t} could not be fetched: ${String(s)}`)}if(!a.ok)throw new Error(`${t} answered HTTP ${a.status}`);try{return await a.json()}catch{throw new Error(n.signal.aborted?`${t} did not answer within ${e} ms`:`${t} is not JSON`)}}finally{clearTimeout(i)}}async function Rt(){const[t,e,r,o,n]=await Promise.all([import("react"),import("react/jsx-runtime"),import("react-dom"),import("react-dom/client"),import("react-dom/server")]);return{react:t,"react/jsx-runtime":e,"react-dom":r,"react-dom/client":o,"react-dom/server":n}}function Nt(t){return import(/* webpackIgnore: true */ /* turbopackIgnore: true */ /* @vite-ignore */ t)}const Ct=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/,Bt=1e4;function bt(t){return t==="staging"?"alpha":t==="qa"?"beta":"stable"}function V(t,e){if(typeof t=="string"&&Ct.test(t))return t;throw new Error(`${e} is ${JSON.stringify(t)??String(t)}, not a runtime version`)}async function Xt({base:t,pin:e,appEnv:r,fetchImpl:o,timeoutMs:n=Bt}){if(e!==void 0)return V(e,"OM_SDK_RUNTIME_VERSION");const i=`${t}/versions.json`,a=await D(i,{cache:"no-cache",timeoutMs:n,fetchImpl:o});if(a===null||typeof a!="object"||Array.isArray(a))throw new Error(`${i} is not an object of versions`);const s=bt(r);return V(a[s],`${i} "${s}"`)}const H="data-om-embed-runtime",U=Symbol.for("outmarket.embed.stylesheetWaiters");function Mt(t,e){return[...e.querySelectorAll(`link[${H}]`)].find(r=>r.getAttribute("href")===t)}function xt(t,e,r){const o=Mt(t,r);if(o!=null&&o.sheet)return Promise.resolve();const n=o??r.createElement("link");return n[U]=(n[U]??0)+1,new Promise((i,a)=>{const s=l=>{clearTimeout(h),n.removeEventListener("load",m),n.removeEventListener("error",c);const f=(n[U]??1)-1;if(n[U]=f,l==="load"){i();return}(l==="error"||f===0)&&n.remove(),a(new Error(l==="error"?`${t} could not be loaded`:`${t} did not load within ${e} ms`))},m=()=>s("load"),c=()=>s("error"),h=setTimeout(()=>s("timeout"),e);n.addEventListener("load",m),n.addEventListener("error",c),o||(n.rel="stylesheet",n.href=t,n.setAttribute(H,""),r.head.appendChild(n))})}async function jt(t,e,r=document){await Promise.all(t.map(o=>xt(o,e,r)))}const z=1,Wt=()=>({fetchImpl:globalThis.fetch,loadHostReact:Rt,importModule:Nt,document,timeouts:{versionsMs:1e4,manifestMs:1e4,cssMs:3e4,entryMs:3e4}});let L;const Yt=/^[A-Za-z0-9_][A-Za-z0-9._-]*$/,$=t=>typeof t=="string"&&t.split("/").every(e=>Yt.test(e));function Ft(t,e,r){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${r} is not a runtime manifest`);const o=t;if(o.version!==e)throw new Error(`${r} is for version ${JSON.stringify(o.version)}, not ${e}`);const{entry:n,worker:i,css:a}=o;if(!$(n))throw new Error(`${r} has no valid "entry"`);if(!$(i))throw new Error(`${r} has no valid "worker"`);if(!Array.isArray(a)||!a.every($))throw new Error(`${r} has no valid "css"`);return{version:e,entry:n,worker:i,css:a}}async function Gt(t,e,r,o){const n=t==null?void 0:t.boot;if(typeof n!="function")throw new Error(`${e} does not export boot()`);const i=await n(r);if((i==null?void 0:i.contractVersion)!==z)throw new Error(`the CDN runtime ${o} implements runtime contract ${String(i==null?void 0:i.contractVersion)}; this SDK needs ${z}`);return i}async function Kt(t,e,r){const[o,n]=await Promise.all([t.loadHostReact(),t.importModule(e)]);return Gt(n,e,o,r)}function Dt(t,e,r){let o;const n=new Promise((i,a)=>{o=setTimeout(()=>a(new Error(r)),e)});return Promise.race([t,n]).finally(()=>clearTimeout(o))}async function Vt(t,e,r={}){const o={...Wt(),...r},{fetchImpl:n,timeouts:i}=o,a=await Xt({...t,fetchImpl:n,timeoutMs:i.versionsMs}),s=`${t.base}/${a}`,m=`${s}/manifest.json`,c=Ft(await D(m,{timeoutMs:i.manifestMs,fetchImpl:n}),a,m),h=jt(c.css.map(Q=>`${s}/${Q}`),i.cssMs,o.document);h.catch(()=>{});const l=e.NEXT_PUBLIC_PDF_WORKER_URL;(l===C.NEXT_PUBLIC_PDF_WORKER_URL||L!==void 0&&l===L)&&(L=`${s}/${c.worker}`,e.NEXT_PUBLIC_PDF_WORKER_URL=L);const f=`${s}/${c.entry}`,Z=await Dt(Kt(o,f,a),i.entryMs,`${f} did not load within ${i.entryMs} ms`);return await h,globalThis.__OM_EMBED__={source:"cdn",base:t.base,version:a},Z}let p=null,I=null;function q(){if(p===null){gt();const t=S();I??(I=Ot(t));const e=Vt(I,t);e.catch(()=>{p===e&&(p=null)}),p=e}return p}function J(t){return et(async()=>{try{return{default:await t(await q())}}catch(e){return console.error("[@outmarket-ai/react-sdk] Could not load the Outmarket components.",e),{default:kt}}})}const Ht={vault:!1,endorsementCheck:!1,events:!1};function zt(t){return{...t,features:{...Ht,...t.features}}}function qt(t,e){const[r,o]=rt(!1);return P(()=>{T({environment:t,apiUrls:e}),o(!0)},[t,e]),r}const Jt=J(t=>t.OutmarketProviderTree),Zt=()=>()=>{},Qt=()=>!0,te=()=>!1;function ee(t){const e=ot(t);P(()=>{e.current=t});const r=it(o=>{var n;return(n=e.current)==null?void 0:n.call(e,zt(o))},[]);return t?r:void 0}function re({environment:t,apiUrls:e,...r}){const o=ee(r.onReady),n=nt(Zt,Qt,te),i=qt(t,e),a=u(G,{color:vt(r)});return!n||!i?a:u(O,{fallback:a,children:u(Jt,{...r,onReady:o})})}async function ne(t){typeof window>"u"||(t&&T({environment:t.environment,apiUrls:t.apiUrls}),await(await q()).signOut())}function d(t,e){const r=J(n=>e(n.surfaces));function o(n){return u(O,{fallback:u(G,{}),children:u(r,{...n})})}return o.displayName=t,o}const oe=d("OutmarketWorkflowsList",t=>t.OutmarketWorkflowsList()),ie=d("OutmarketWorkflowForm",t=>t.OutmarketWorkflowForm()),ae=d("OutmarketWorkflowConversation",t=>t.OutmarketWorkflowConversation()),se=d("OutmarketWorkflowHistory",t=>t.OutmarketWorkflowHistory()),ue=d("OutmarketVault",t=>t.OutmarketVault()),ce=d("OutmarketEndorsementCheck",t=>t.OutmarketEndorsementCheck()),le={commercial_lines:"Commercial Insurance",personal_lines:"Personal Lines",benefits:"Employee Benefits"};export{le as MODULE_TITLE,ce as OutmarketEndorsementCheck,re as OutmarketProvider,ue as OutmarketVault,ae as OutmarketWorkflowConversation,ie as OutmarketWorkflowForm,se as OutmarketWorkflowHistory,oe as OutmarketWorkflowsList,ne as signOut};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outmarket-ai/react-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.7.0-alpha.1",
4
4
  "description": "Embed the real Outmarket workflows and Vault in any React app.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -62,5 +62,5 @@
62
62
  "url": "git+https://github.com/Outmarket-AI/outmarket-monorepo.git",
63
63
  "directory": "apps/product-frontend/packages/outmarket-react-sdk"
64
64
  },
65
- "gitHead": "72c80009e55ac315f74e860aa4bec872ff1c0ccc"
65
+ "gitHead": "9d6ec3aadab31b83f7fa9794389897ed5d05dfd9"
66
66
  }