@usefillo/core 0.3.0 → 0.3.2

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
@@ -161,10 +161,15 @@ interface FormTheme {
161
161
  radius?: string;
162
162
  fontFamily?: string;
163
163
  }
164
- /** Workspace branding state, resolved by the server from the plan. */
164
+ /** Branding the server tells the SDK to render. Server-owned so the wording /
165
+ * link can change centrally without a new SDK release. */
165
166
  interface FormBranding {
166
- /** Show the "Powered by Fillo" badge. True on free plans; paid removes it. */
167
+ /** Show the "Powered by Fillo" badge. */
167
168
  poweredBy: boolean;
169
+ /** Badge text — the SDK falls back to "Powered by Fillo" if absent. */
170
+ label?: string;
171
+ /** Badge link — the SDK falls back to https://fillo.so if absent. */
172
+ href?: string;
168
173
  }
169
174
  /** A completed upload, referenced from response data. */
170
175
  interface FileValue {
@@ -342,17 +347,17 @@ interface FormDraftSpec {
342
347
  declare function assembleForm(spec: FormDraftSpec): FormSchema;
343
348
 
344
349
  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
350
  /**
352
351
  * Publishable workspace key (pk_…) — safe to ship in client code. Required
353
352
  * only for syncing code-defined forms into the workspace.
354
353
  */
355
354
  key?: string;
355
+ /**
356
+ * Internal: send requests to this page's own origin instead of the hosted
357
+ * API. Used only by Fillo's own first-party pages (hosted forms, marketing)
358
+ * so they hit localhost in dev and fillo.so in prod. Not for embedding.
359
+ */
360
+ sameOrigin?: boolean;
356
361
  fetch?: typeof fetch;
357
362
  }
358
363
  interface PublishedForm {
@@ -497,7 +502,8 @@ interface ProvisionWorkspaceResult {
497
502
  */
498
503
  declare function provisionWorkspace(options: {
499
504
  email: string;
500
- baseUrl?: string;
505
+ /** Internal: hit this page's own origin (Fillo's own pages). */
506
+ sameOrigin?: boolean;
501
507
  /** Free-form provenance label, e.g. "agent" | "cli". */
502
508
  source?: string;
503
509
  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.2",
4
4
  "description": "Form schema, validation, logic engine and JS client for Fillo. Framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "keywords": [