@brainfish-ai/web-tracker 0.0.21 → 0.0.23

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.
@@ -3589,6 +3589,22 @@ class TrackerSdk {
3589
3589
  } else {
3590
3590
  console.warn("BrainfishWidgetWarn: `.identify` called without a userId. User identification requires a valid userId to be provided.");
3591
3591
  }
3592
+ const allowedFields = /* @__PURE__ */ new Set([
3593
+ "userId",
3594
+ "firstName",
3595
+ "lastName",
3596
+ "email",
3597
+ "phone",
3598
+ "avatar",
3599
+ "properties"
3600
+ ]);
3601
+ const extraFields = Object.keys(payload).filter((key) => !allowedFields.has(key));
3602
+ if (extraFields.length > 0) {
3603
+ console.warn(`BrainfishWidgetWarn: The following fields are not recognized as main identifier fields: ${extraFields.join(", ")}. Please place custom fields under the 'properties' object instead. Note: Using fields incorrectly may cause user identification to not work as expected.`);
3604
+ }
3605
+ if (payload.phone && !/^\+[1-9]\d{1,14}$/.test(payload.phone)) {
3606
+ console.warn("BrainfishWidgetWarn: phone should be in E.164 format (e.g., +14155552671). Providing the correct format ensures accurate user identification.");
3607
+ }
3592
3608
  const iframe = document.querySelector("#bf-iframe-container .trigger-iframe");
3593
3609
  if (iframe) {
3594
3610
  const sendMessage = () => {
@@ -3662,8 +3678,6 @@ class TrackerSdk {
3662
3678
  this.queue.forEach((item) => {
3663
3679
  this.send({
3664
3680
  ...item,
3665
- // Not sure why ts-expect-error is needed here
3666
- // @ts-expect-error
3667
3681
  payload: {
3668
3682
  ...item.payload,
3669
3683
  userId: item.payload.userId ?? this.userId
@@ -29281,7 +29295,6 @@ class Sender {
29281
29295
  }
29282
29296
  handle(event) {
29283
29297
  if (event.type === EventType$1.FullSnapshot && this.eventBuffer.find((e) => e.type === EventType$1.FullSnapshot)) {
29284
- console.warn("Full snapshot already in buffer, ignoring...");
29285
29298
  return;
29286
29299
  }
29287
29300
  this.eventBuffer.push(event);
@@ -29292,8 +29305,6 @@ class Sender {
29292
29305
  if (this.agent.sendEvents) {
29293
29306
  const events = this.eventBuffer.flush();
29294
29307
  await this.agent.sendEvents(events);
29295
- } else {
29296
- console.warn("No send function provided to Agent");
29297
29308
  }
29298
29309
  }
29299
29310
  }
@@ -38429,7 +38440,7 @@ function toCamelCase(str) {
38429
38440
  ($1) => $1.toUpperCase().replace("-", "").replace("_", "")
38430
38441
  );
38431
38442
  }
38432
- const VERSION = "0.0.21";
38443
+ const VERSION = "0.0.23";
38433
38444
  class Tracker extends TrackerSdk {
38434
38445
  // 750KB
38435
38446
  constructor(options) {
@@ -38462,6 +38473,7 @@ class Tracker extends TrackerSdk {
38462
38473
  }
38463
38474
  if (this.options.enableRecording && this.options._allowScreenRecording) {
38464
38475
  this.startRecording();
38476
+ console.log("Brainfish has started ambient learning");
38465
38477
  }
38466
38478
  }
38467
38479
  }
Binary file