@usefillo/dom 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.js CHANGED
@@ -582,9 +582,10 @@ var DomFormController = class {
582
582
  this.setSchema(schema, this.options.theme, this.options.formId);
583
583
  return;
584
584
  }
585
- if (!this.options.client || !this.options.formId) {
586
- throw new FilloError("Provide either `form`, or `client` with `formId`.", 0);
585
+ if (!this.options.formId) {
586
+ throw new FilloError("Provide either `form`, or a `formId`.", 0);
587
587
  }
588
+ this.options.client ??= createClient();
588
589
  this.render();
589
590
  const published = await this.options.client.getForm(this.options.formId);
590
591
  this.closed = Boolean(published.closed);
@@ -891,7 +892,7 @@ var FilloFormElement = class extends HTMLElement {
891
892
  const baseUrl = this.getAttribute("base-url");
892
893
  const key = this.getAttribute("publishable-key") ?? void 0;
893
894
  const formId = this.getAttribute("form-id") ?? void 0;
894
- const client = this.assignedClient ?? (baseUrl ? createClient({ baseUrl, key }) : void 0);
895
+ const client = this.assignedClient ?? (formId || key || baseUrl ? createClient({ baseUrl: baseUrl ?? void 0, key }) : void 0);
895
896
  this.instance = renderForm(this, {
896
897
  form: this.assignedForm,
897
898
  client,