@usefillo/core 0.13.0 → 0.14.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/dist/index.d.ts CHANGED
@@ -1118,6 +1118,16 @@ interface SubmitMeta {
1118
1118
  elapsedMs?: number;
1119
1119
  /** Embedding surface, recorded per response for measurement — never gated. */
1120
1120
  surface?: "default" | "headless";
1121
+ /**
1122
+ * Browser page context used by connected analytics/CRM destinations. Fillo
1123
+ * reads an existing HubSpot tracking cookie when present but never creates
1124
+ * one or loads tracking code.
1125
+ */
1126
+ attribution?: {
1127
+ pageUri?: string;
1128
+ pageName?: string;
1129
+ hubspotutk?: string;
1130
+ };
1121
1131
  /**
1122
1132
  * Browser-scoped de-duplication key sent when a form opts into
1123
1133
  * settings.responseLimit.by = "browser".
package/dist/index.js CHANGED
@@ -1088,7 +1088,7 @@ var schemaShape = z2.object({
1088
1088
  });
1089
1089
  var MAX_SCHEMA_VERSION = 1;
1090
1090
  var FILLO_SCHEMA_VERSION = 1;
1091
- var FILLO_SDK_VERSION = true ? "0.13.0" : "0.0.0-dev";
1091
+ var FILLO_SDK_VERSION = true ? "0.14.0" : "0.0.0-dev";
1092
1092
  var FILLO_MIN_SDK_VERSION = "0.4.0";
1093
1093
  var FILLO_CHALLENGE_MIN_SDK_VERSION = "0.9.0";
1094
1094
  var FILLO_CALC_MIN_SDK_VERSION = "0.11.0";
@@ -3224,6 +3224,22 @@ function prefillFromParams(form, params) {
3224
3224
  }
3225
3225
 
3226
3226
  // src/controller.ts
3227
+ function browserAttribution() {
3228
+ if (typeof document === "undefined" || typeof window === "undefined") return void 0;
3229
+ try {
3230
+ const page = new URL(window.location.href);
3231
+ page.hash = "";
3232
+ const hubspotutk = document.cookie.split(";").map((part) => part.trim()).find((part) => part.startsWith("hubspotutk="))?.slice("hubspotutk=".length);
3233
+ const attribution = {
3234
+ pageUri: page.href.slice(0, 2048),
3235
+ pageName: document.title.trim().slice(0, 200) || void 0,
3236
+ hubspotutk: hubspotutk && /^[a-f0-9]{32}$/i.test(hubspotutk) ? hubspotutk : void 0
3237
+ };
3238
+ return Object.values(attribution).some(Boolean) ? attribution : void 0;
3239
+ } catch {
3240
+ return void 0;
3241
+ }
3242
+ }
3227
3243
  var EMPTY_PAGE = { id: "empty", blocks: [] };
3228
3244
  var warnedNoClient = false;
3229
3245
  var warnedNoFormId = false;
@@ -3782,6 +3798,7 @@ function createFormController(options2) {
3782
3798
  hp: options2.getHoneypot?.() ?? "",
3783
3799
  elapsedMs: Date.now() - mountedAt,
3784
3800
  surface: options2.surface ?? "headless",
3801
+ attribution: browserAttribution(),
3785
3802
  submissionKey,
3786
3803
  draft: submitDraft ? { id: submitDraft.id, token: submitDraft.token } : void 0,
3787
3804
  respondent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/core",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Form schema, validation, logic engine and JS client for Fillo. Framework-agnostic.",
5
5
  "license": "MIT",
6
6
  "keywords": [