@usefillo/core 0.2.0 → 0.2.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/dist/index.d.ts +8 -4
- package/dist/index.js +4 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -321,8 +321,12 @@ interface FormDraftSpec {
|
|
|
321
321
|
declare function assembleForm(spec: FormDraftSpec): FormSchema;
|
|
322
322
|
|
|
323
323
|
interface FilloClientOptions {
|
|
324
|
-
/**
|
|
325
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Where the SDK sends requests. Defaults to the hosted API (https://fillo.so).
|
|
326
|
+
* Only set this if you reverse-proxy Fillo through your own domain — e.g. to
|
|
327
|
+
* keep traffic first-party or dodge ad-blockers, like PostHog's api_host.
|
|
328
|
+
*/
|
|
329
|
+
baseUrl?: string;
|
|
326
330
|
/**
|
|
327
331
|
* Publishable workspace key (pk_…) — safe to ship in client code. Required
|
|
328
332
|
* only for syncing code-defined forms into the workspace.
|
|
@@ -376,7 +380,7 @@ declare class FilloClient {
|
|
|
376
380
|
private fetch;
|
|
377
381
|
/** Publishable workspace key, when configured. */
|
|
378
382
|
readonly key?: string;
|
|
379
|
-
constructor(options
|
|
383
|
+
constructor(options?: FilloClientOptions);
|
|
380
384
|
private url;
|
|
381
385
|
private json;
|
|
382
386
|
/** Fetch a published form definition by id or slug. */
|
|
@@ -430,7 +434,7 @@ declare class FilloClient {
|
|
|
430
434
|
*/
|
|
431
435
|
private s3PutUpload;
|
|
432
436
|
}
|
|
433
|
-
declare function createClient(options
|
|
437
|
+
declare function createClient(options?: FilloClientOptions): FilloClient;
|
|
434
438
|
|
|
435
439
|
type FormStatus = "idle" | "submitting" | "submitted" | "error";
|
|
436
440
|
interface FormControllerOptions {
|
package/dist/index.js
CHANGED
|
@@ -570,14 +570,15 @@ function makeReporter(totalBytes, options) {
|
|
|
570
570
|
fraction: totalBytes === 0 ? 1 : uploadedBytes / totalBytes
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
|
+
var DEFAULT_BASE_URL = "https://fillo.so";
|
|
573
574
|
var FilloClient = class {
|
|
574
575
|
/** Server origin this client targets, normalized (no trailing slash). */
|
|
575
576
|
baseUrl;
|
|
576
577
|
fetch;
|
|
577
578
|
/** Publishable workspace key, when configured. */
|
|
578
579
|
key;
|
|
579
|
-
constructor(options) {
|
|
580
|
-
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
580
|
+
constructor(options = {}) {
|
|
581
|
+
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
581
582
|
this.key = options.key;
|
|
582
583
|
this.fetch = options.fetch ?? ((...args) => globalThis.fetch(...args));
|
|
583
584
|
}
|
|
@@ -835,7 +836,7 @@ var FilloClient = class {
|
|
|
835
836
|
}
|
|
836
837
|
}
|
|
837
838
|
};
|
|
838
|
-
function createClient(options) {
|
|
839
|
+
function createClient(options = {}) {
|
|
839
840
|
return new FilloClient(options);
|
|
840
841
|
}
|
|
841
842
|
|