@brainfish-ai/web-tracker 0.0.22 → 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
@@ -38426,7 +38440,7 @@ function toCamelCase(str) {
38426
38440
  ($1) => $1.toUpperCase().replace("-", "").replace("_", "")
38427
38441
  );
38428
38442
  }
38429
- const VERSION = "0.0.22";
38443
+ const VERSION = "0.0.23";
38430
38444
  class Tracker extends TrackerSdk {
38431
38445
  // 750KB
38432
38446
  constructor(options) {
Binary file