@usefillo/core 0.3.0 → 0.3.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
@@ -15,7 +15,7 @@ npm i @usefillo/core
15
15
  ```ts
16
16
  import { createClient, defineForm, validateResponse, visibleBlocks } from "@usefillo/core";
17
17
 
18
- const client = createClient({ baseUrl: "https://fillo.so" });
18
+ const client = createClient({ key: "pk_live_…" });
19
19
 
20
20
  const form = defineForm({
21
21
  id: "cust-feedback",
package/dist/index.d.ts CHANGED
@@ -342,17 +342,17 @@ interface FormDraftSpec {
342
342
  declare function assembleForm(spec: FormDraftSpec): FormSchema;
343
343
 
344
344
  interface FilloClientOptions {
345
- /**
346
- * Where the SDK sends requests. Defaults to the hosted API (https://fillo.so).
347
- * Only set this if you reverse-proxy Fillo through your own domain — e.g. to
348
- * keep traffic first-party or dodge ad-blockers, like PostHog's api_host.
349
- */
350
- baseUrl?: string;
351
345
  /**
352
346
  * Publishable workspace key (pk_…) — safe to ship in client code. Required
353
347
  * only for syncing code-defined forms into the workspace.
354
348
  */
355
349
  key?: string;
350
+ /**
351
+ * Internal: send requests to this page's own origin instead of the hosted
352
+ * API. Used only by Fillo's own first-party pages (hosted forms, marketing)
353
+ * so they hit localhost in dev and fillo.so in prod. Not for embedding.
354
+ */
355
+ sameOrigin?: boolean;
356
356
  fetch?: typeof fetch;
357
357
  }
358
358
  interface PublishedForm {
@@ -497,7 +497,8 @@ interface ProvisionWorkspaceResult {
497
497
  */
498
498
  declare function provisionWorkspace(options: {
499
499
  email: string;
500
- baseUrl?: string;
500
+ /** Internal: hit this page's own origin (Fillo's own pages). */
501
+ sameOrigin?: boolean;
501
502
  /** Free-form provenance label, e.g. "agent" | "cli". */
502
503
  source?: string;
503
504
  fetch?: typeof fetch;
package/dist/index.js CHANGED
@@ -696,7 +696,7 @@ var FilloClient = class {
696
696
  /** Publishable workspace key, when configured. */
697
697
  key;
698
698
  constructor(options = {}) {
699
- this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
699
+ this.baseUrl = options.sameOrigin ? "" : DEFAULT_BASE_URL;
700
700
  this.key = options.key;
701
701
  this.fetch = options.fetch ?? ((...args) => globalThis.fetch(...args));
702
702
  }
@@ -1026,9 +1026,9 @@ function createClient(options = {}) {
1026
1026
  return new FilloClient(options);
1027
1027
  }
1028
1028
  async function provisionWorkspace(options) {
1029
- const baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
1029
+ const base = options.sameOrigin ? "" : DEFAULT_BASE_URL;
1030
1030
  const doFetch = options.fetch ?? ((...args) => globalThis.fetch(...args));
1031
- const res = await doFetch(`${baseUrl}/api/v1/workspaces/provision`, {
1031
+ const res = await doFetch(`${base}/api/v1/workspaces/provision`, {
1032
1032
  method: "POST",
1033
1033
  headers: { "Content-Type": "application/json" },
1034
1034
  body: JSON.stringify({ email: options.email, source: options.source ?? "sdk" })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/core",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Form schema, validation, logic engine and JS client for Fillo. Framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "keywords": [