@helpai/elements 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -335,7 +335,7 @@ mount({
335
335
  publicKey: "agent_pk_...",
336
336
  aiAgentDeploymentId: "...",
337
337
  presentation: { mode: "floating" },
338
- baseUrl: "https://help.ai/api", // omit to use the brand default
338
+ baseUrl: "https://help.ai", // omit to use the brand default
339
339
  user: { id: "u_123", email: "alice@help.ai" },
340
340
  theme: "dark", // "auto" | "light" | "dark" | overrides object
341
341
  i18n: { defaultLocale: "en" },
package/configurator.mjs CHANGED
@@ -520,7 +520,7 @@ var moduleSchema = z14.object({
520
520
  "UI layout that renders this tab: `chat` (the conversation), `home`, `help`, or `news`."
521
521
  ),
522
522
  contentTags: z14.array(z14.string().max(60)).max(20).optional().describe(
523
- "Content tags this tab scopes to \u2014 the `tags` filter on `GET /ai/agent/content` (matches content tagged with ANY of them). Omit for the `chat` layout."
523
+ "Content tags this tab scopes to \u2014 the `tags` filter on `GET /content` (matches content tagged with ANY of them). Omit for the `chat` layout."
524
524
  ),
525
525
  id: z14.string().max(60).optional().describe(
526
526
  "Stable id for navigation + last-tab persistence. Defaults to the first `contentTags` entry, else `layout`."
@@ -573,7 +573,9 @@ var modulesSchema = z14.array(moduleSchema).max(4).describe(
573
573
  import { z as z15 } from "zod";
574
574
  var trackingSchema = z15.object({
575
575
  enabled: z15.boolean().optional().describe("Master switch. Default `false` \u2014 no hits are sent until the deployment turns tracking on."),
576
- endpoint: z15.url().max(2048).optional().describe("Pixel collector URL. Default: `https://t.<brand domain>/api/ai-elements/px.gif`. Must be a full URL."),
576
+ endpoint: z15.url().max(2048).optional().describe(
577
+ "Pixel collector URL. Default: `${dataBaseUrl}/elements/px.gif` (e.g. `https://help.ai/api/data/elements/px.gif`). Must be a full URL."
578
+ ),
577
579
  sampleRate: z15.number().min(0).max(1).optional().describe("Per-visitor sampling 0..1 (decided once per page load, keeping funnels intact). Default `1`."),
578
580
  token: z15.string().max(512).optional().describe(
579
581
  "Anti-forgery token, echoed as `tk=` on every hit. Server-issued in the `/start-conversation` response \u2014 never set by hand (see `docs/api/tracking-collector.md`)."
@@ -588,10 +590,12 @@ var trackingSchema = z15.object({
588
590
  var endpointsSchema = z16.object({
589
591
  upload: z16.string().min(1).max(2048).default("/ai/agent/upload-file"),
590
592
  transcribe: z16.string().min(1).max(2048).default("/ai/agent/transcribe-audio"),
591
- submitForm: z16.string().min(1).max(2048).default("/ai/agent/submit-form").describe(
593
+ submitForm: z16.string().min(1).max(2048).default("/submit-form").describe(
592
594
  "Form submission endpoint. The widget POSTs each completed form's values here (fire-and-forget), keyed by the same visitorId + conversationId as the conversation; the payload carries `formId` + `trigger` so the backend can route. Optional \u2014 a 404 is ignored."
593
595
  )
594
- }).loose().describe("HTTP endpoint overrides. Paths are appended to baseUrl; absolute URLs are accepted too.").meta({
596
+ }).loose().describe(
597
+ "HTTP endpoint overrides. `upload` / `transcribe` paths are appended to the agent base (`${baseUrl}/api/agent`), `submitForm` to the data base (`dataBaseUrl`); absolute URLs are accepted too."
598
+ ).meta({
595
599
  examples: [
596
600
  { upload: "/ai/agent/upload-file", transcribe: "/ai/agent/transcribe-audio" },
597
601
  { upload: "https://help.ai/uploads/presign" },
@@ -640,7 +644,10 @@ var connectionConfigSchema = z16.object({
640
644
  "Deployment UUID from the dashboard. Picks which agent / settings bundle answers this mount. Sent as `x-ai-agent-deployment-id`."
641
645
  ),
642
646
  baseUrl: z16.string().min(1).max(2048).optional().describe(
643
- "Full backend origin (e.g. `https://help.ai/api`). Set this to point at your staging / self-hosted / custom backend. Default: the brand's `defaultBaseUrl` baked at build time."
647
+ "MAIN site origin (e.g. `https://help.ai`) \u2014 the API modules derive from it: agent API at `${baseUrl}/api/agent`, data API at `${baseUrl}/api/data`. Set this to point at your staging / self-hosted / custom backend. Default: the brand's `defaultBaseUrl` baked at build time."
648
+ ),
649
+ dataBaseUrl: z16.string().min(1).max(2048).optional().describe(
650
+ "Full data-API base (e.g. `https://help.ai/api/data`) \u2014 the service serving content, form definitions (`GET /forms`), and form submissions at root-level paths. Precedence: this option > server-pushed `config.dataBaseUrl` > derived from the main origin (`${baseUrl}/api/data`)."
644
651
  ),
645
652
  userContext: userContextSchema.optional(),
646
653
  pageContext: pageContextSchema.optional(),
@@ -725,7 +732,9 @@ var connectionConfigPartialSchema = connectionConfigSchema.partial();
725
732
 
726
733
  // src/schema/deployment.ts
727
734
  import { z as z17 } from "zod";
728
- var serverConfigSchema = widgetSettingsSchema.partial();
735
+ var serverConfigSchema = widgetSettingsSchema.partial().omit({ forms: true }).extend({
736
+ dataBaseUrl: z17.string().min(1).max(2048).optional()
737
+ });
729
738
  var siteConfigSchema = z17.object({
730
739
  title: z17.string().min(1).max(120).optional().describe("Brand / site name. Used as the logo's alt-text fallback."),
731
740
  logo: assetSchema.optional().describe("Brand logo shown at the top of the page-mode sidebar."),
@@ -784,20 +793,6 @@ var startConversationResponseSchema = z17.object({
784
793
  conversationId: z17.string(),
785
794
  canContinue: z17.boolean(),
786
795
  messages: z17.array(z17.unknown()),
787
- /**
788
- * Form submissions recorded for this conversation — echoed like
789
- * `messages` so the widget reconstructs the collapsed "form submitted"
790
- * timeline markers on resume. `createdAt` is ISO-8601 (a serialized
791
- * Mongo ISODate — same format as message `createdAt`).
792
- */
793
- formSubmissions: z17.array(
794
- z17.object({
795
- formId: z17.string(),
796
- trigger: z17.string(),
797
- skipped: z17.boolean().optional(),
798
- createdAt: z17.iso.datetime().optional()
799
- }).loose()
800
- ).optional(),
801
796
  /**
802
797
  * Per-visitor preferences (locale picker, theme picker, sound
803
798
  * mute, dragged panel size). Distinct from `config` — this is