@usertour/helpers 0.0.27 → 0.0.29

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.
@@ -352,7 +352,7 @@ var filterConditionsByType = (conditions, allowedTypes) => {
352
352
  });
353
353
  };
354
354
  var evaluateRule = async (condition, options) => {
355
- var _a;
355
+ var _a, _b;
356
356
  const { typeControl = {}, activatedIds, deactivatedIds, customEvaluators } = options;
357
357
  const conditionId = condition.id;
358
358
  if (activatedIds == null ? void 0 : activatedIds.includes(conditionId))
@@ -369,11 +369,10 @@ var evaluateRule = async (condition, options) => {
369
369
  }
370
370
  switch (condition.type) {
371
371
  case import_types2.RulesType.CURRENT_PAGE:
372
- return evaluateUrlCondition(condition, ((_a = options.clientContext) == null ? void 0 : _a.page_url) || "");
372
+ return evaluateUrlCondition(condition, (_b = (_a = options.clientContext) == null ? void 0 : _a.pageUrl) != null ? _b : "");
373
373
  case import_types2.RulesType.TIME:
374
374
  return evaluateTimeCondition(condition);
375
375
  case import_types2.RulesType.USER_ATTR:
376
- case import_types2.RulesType.COMPANY_ATTR:
377
376
  return evaluateAttributeCondition(
378
377
  condition,
379
378
  options.attributes || [],
@@ -642,9 +641,9 @@ describe("evaluateRulesConditions", () => {
642
641
  ];
643
642
  const mockOptions = {
644
643
  clientContext: {
645
- page_url: "https://example.com",
646
- viewport_width: 1920,
647
- viewport_height: 1080
644
+ pageUrl: "https://example.com",
645
+ viewportWidth: 1920,
646
+ viewportHeight: 1080
648
647
  },
649
648
  attributes: [
650
649
  {
@@ -1004,9 +1003,9 @@ describe("evaluateRulesConditions", () => {
1004
1003
  };
1005
1004
  const options = {
1006
1005
  clientContext: {
1007
- page_url: "https://example.com",
1008
- viewport_width: 1920,
1009
- viewport_height: 1080
1006
+ pageUrl: "https://example.com",
1007
+ viewportWidth: 1920,
1008
+ viewportHeight: 1080
1010
1009
  },
1011
1010
  typeControl: {
1012
1011
  [import_types3.RulesType.CURRENT_PAGE]: true
@@ -2,7 +2,7 @@ import {
2
2
  evaluateRulesConditions,
3
3
  filterConditionsByType,
4
4
  isConditionsActived
5
- } from "../chunk-KQRO6BRK.js";
5
+ } from "../chunk-E2IJQFKH.js";
6
6
  import "../chunk-YYIGUZNZ.js";
7
7
  import "../chunk-PAESAL23.js";
8
8
  import "../chunk-PBZSPV5R.js";
@@ -251,9 +251,9 @@ describe("evaluateRulesConditions", () => {
251
251
  ];
252
252
  const mockOptions = {
253
253
  clientContext: {
254
- page_url: "https://example.com",
255
- viewport_width: 1920,
256
- viewport_height: 1080
254
+ pageUrl: "https://example.com",
255
+ viewportWidth: 1920,
256
+ viewportHeight: 1080
257
257
  },
258
258
  attributes: [
259
259
  {
@@ -613,9 +613,9 @@ describe("evaluateRulesConditions", () => {
613
613
  };
614
614
  const options = {
615
615
  clientContext: {
616
- page_url: "https://example.com",
617
- viewport_width: 1920,
618
- viewport_height: 1080
616
+ pageUrl: "https://example.com",
617
+ viewportWidth: 1920,
618
+ viewportHeight: 1080
619
619
  },
620
620
  typeControl: {
621
621
  [RulesType.CURRENT_PAGE]: true
@@ -45,7 +45,7 @@ var filterConditionsByType = (conditions, allowedTypes) => {
45
45
  });
46
46
  };
47
47
  var evaluateRule = async (condition, options) => {
48
- var _a;
48
+ var _a, _b;
49
49
  const { typeControl = {}, activatedIds, deactivatedIds, customEvaluators } = options;
50
50
  const conditionId = condition.id;
51
51
  if (activatedIds == null ? void 0 : activatedIds.includes(conditionId))
@@ -62,11 +62,10 @@ var evaluateRule = async (condition, options) => {
62
62
  }
63
63
  switch (condition.type) {
64
64
  case RulesType.CURRENT_PAGE:
65
- return evaluateUrlCondition(condition, ((_a = options.clientContext) == null ? void 0 : _a.page_url) || "");
65
+ return evaluateUrlCondition(condition, (_b = (_a = options.clientContext) == null ? void 0 : _a.pageUrl) != null ? _b : "");
66
66
  case RulesType.TIME:
67
67
  return evaluateTimeCondition(condition);
68
68
  case RulesType.USER_ATTR:
69
- case RulesType.COMPANY_ATTR:
70
69
  return evaluateAttributeCondition(
71
70
  condition,
72
71
  options.attributes || [],
@@ -367,7 +367,7 @@ var filterConditionsByType = (conditions, allowedTypes) => {
367
367
  });
368
368
  };
369
369
  var evaluateRule = async (condition, options) => {
370
- var _a;
370
+ var _a, _b;
371
371
  const { typeControl = {}, activatedIds, deactivatedIds, customEvaluators } = options;
372
372
  const conditionId = condition.id;
373
373
  if (activatedIds == null ? void 0 : activatedIds.includes(conditionId))
@@ -384,11 +384,10 @@ var evaluateRule = async (condition, options) => {
384
384
  }
385
385
  switch (condition.type) {
386
386
  case import_types2.RulesType.CURRENT_PAGE:
387
- return evaluateUrlCondition(condition, ((_a = options.clientContext) == null ? void 0 : _a.page_url) || "");
387
+ return evaluateUrlCondition(condition, (_b = (_a = options.clientContext) == null ? void 0 : _a.pageUrl) != null ? _b : "");
388
388
  case import_types2.RulesType.TIME:
389
389
  return evaluateTimeCondition(condition);
390
390
  case import_types2.RulesType.USER_ATTR:
391
- case import_types2.RulesType.COMPANY_ATTR:
392
391
  return evaluateAttributeCondition(
393
392
  condition,
394
393
  options.attributes || [],
@@ -5,7 +5,7 @@ import {
5
5
  filterConditionsByType,
6
6
  isConditionsActived,
7
7
  isEqual
8
- } from "../chunk-KQRO6BRK.js";
8
+ } from "../chunk-E2IJQFKH.js";
9
9
  import "../chunk-YYIGUZNZ.js";
10
10
  import "../chunk-PAESAL23.js";
11
11
  import "../chunk-PBZSPV5R.js";
@@ -373,7 +373,7 @@ var filterConditionsByType = (conditions, allowedTypes) => {
373
373
  });
374
374
  };
375
375
  var evaluateRule = async (condition, options) => {
376
- var _a;
376
+ var _a, _b;
377
377
  const { typeControl = {}, activatedIds, deactivatedIds, customEvaluators } = options;
378
378
  const conditionId = condition.id;
379
379
  if (activatedIds == null ? void 0 : activatedIds.includes(conditionId))
@@ -390,11 +390,10 @@ var evaluateRule = async (condition, options) => {
390
390
  }
391
391
  switch (condition.type) {
392
392
  case import_types2.RulesType.CURRENT_PAGE:
393
- return evaluateUrlCondition(condition, ((_a = options.clientContext) == null ? void 0 : _a.page_url) || "");
393
+ return evaluateUrlCondition(condition, (_b = (_a = options.clientContext) == null ? void 0 : _a.pageUrl) != null ? _b : "");
394
394
  case import_types2.RulesType.TIME:
395
395
  return evaluateTimeCondition(condition);
396
396
  case import_types2.RulesType.USER_ATTR:
397
- case import_types2.RulesType.COMPANY_ATTR:
398
397
  return evaluateAttributeCondition(
399
398
  condition,
400
399
  options.attributes || [],
@@ -6,7 +6,7 @@ import {
6
6
  filterConditionsByType,
7
7
  isConditionsActived,
8
8
  isEqual
9
- } from "../chunk-KQRO6BRK.js";
9
+ } from "../chunk-E2IJQFKH.js";
10
10
  import {
11
11
  evaluateUrlCondition,
12
12
  isMatchUrlPattern
package/dist/index.cjs CHANGED
@@ -1339,7 +1339,7 @@ var filterConditionsByType = (conditions, allowedTypes) => {
1339
1339
  });
1340
1340
  };
1341
1341
  var evaluateRule = async (condition, options) => {
1342
- var _a;
1342
+ var _a, _b;
1343
1343
  const { typeControl = {}, activatedIds, deactivatedIds, customEvaluators } = options;
1344
1344
  const conditionId = condition.id;
1345
1345
  if (activatedIds == null ? void 0 : activatedIds.includes(conditionId))
@@ -1356,11 +1356,10 @@ var evaluateRule = async (condition, options) => {
1356
1356
  }
1357
1357
  switch (condition.type) {
1358
1358
  case import_types5.RulesType.CURRENT_PAGE:
1359
- return evaluateUrlCondition(condition, ((_a = options.clientContext) == null ? void 0 : _a.page_url) || "");
1359
+ return evaluateUrlCondition(condition, (_b = (_a = options.clientContext) == null ? void 0 : _a.pageUrl) != null ? _b : "");
1360
1360
  case import_types5.RulesType.TIME:
1361
1361
  return evaluateTimeCondition(condition);
1362
1362
  case import_types5.RulesType.USER_ATTR:
1363
- case import_types5.RulesType.COMPANY_ATTR:
1364
1363
  return evaluateAttributeCondition(
1365
1364
  condition,
1366
1365
  options.attributes || [],
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  filterConditionsByType,
18
18
  isConditionsActived,
19
19
  isEqual
20
- } from "./chunk-KQRO6BRK.js";
20
+ } from "./chunk-E2IJQFKH.js";
21
21
  import {
22
22
  evaluateUrlCondition,
23
23
  isMatchUrlPattern
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usertour/helpers",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "type": "module",
5
5
  "description": "Utility functions and helpers shared across the UserTour project",
6
6
  "homepage": "https://www.usertour.io",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@paralleldrive/cuid2": "^2.2.2",
32
- "@usertour/types": "^0.0.14",
32
+ "@usertour/types": "^0.0.17",
33
33
  "chroma-js": "^3.1.2",
34
34
  "class-variance-authority": "^0.4.0",
35
35
  "clsx": "^1.2.1",