@usertour/helpers 0.0.11 → 0.0.13

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.
@@ -0,0 +1,50 @@
1
+ import {
2
+ PRIORITIES,
3
+ activedContentCondition,
4
+ activedContentRulesConditions,
5
+ activedRulesConditions,
6
+ checklistIsDimissed,
7
+ checklistIsSeen,
8
+ completeEventMapping,
9
+ filterAutoStartContent,
10
+ findLatestEvent,
11
+ flowIsDismissed,
12
+ flowIsSeen,
13
+ isActive,
14
+ isActiveContent,
15
+ isActiveRulesByCurrentPage,
16
+ isActiveRulesByCurrentTime,
17
+ isDismissedEventMapping,
18
+ isHasActivedContents,
19
+ isSameContents,
20
+ isValidContent,
21
+ parseUrlParams,
22
+ rulesTypes,
23
+ wait
24
+ } from "./chunk-SYVTGB2A.js";
25
+ import "./chunk-FNQIIEWK.js";
26
+ import "./chunk-XEO3YXBM.js";
27
+ export {
28
+ PRIORITIES,
29
+ activedContentCondition,
30
+ activedContentRulesConditions,
31
+ activedRulesConditions,
32
+ checklistIsDimissed,
33
+ checklistIsSeen,
34
+ completeEventMapping,
35
+ filterAutoStartContent,
36
+ findLatestEvent,
37
+ flowIsDismissed,
38
+ flowIsSeen,
39
+ isActive,
40
+ isActiveContent,
41
+ isActiveRulesByCurrentPage,
42
+ isActiveRulesByCurrentTime,
43
+ isDismissedEventMapping,
44
+ isHasActivedContents,
45
+ isSameContents,
46
+ isValidContent,
47
+ parseUrlParams,
48
+ rulesTypes,
49
+ wait
50
+ };
package/dist/index.cjs CHANGED
@@ -39,9 +39,12 @@ __export(src_exports, {
39
39
  ArrayProto: () => ArrayProto,
40
40
  XMLHttpRequest: () => XMLHttpRequest,
41
41
  absoluteUrl: () => absoluteUrl,
42
+ activedContentRulesConditions: () => activedContentRulesConditions,
42
43
  assignableWindow: () => assignableWindow,
43
44
  autoStartConditions: () => autoStartConditions,
44
45
  buildConfig: () => buildConfig,
46
+ checklistIsDimissed: () => checklistIsDimissed,
47
+ checklistIsSeen: () => checklistIsSeen,
45
48
  cn: () => cn,
46
49
  conditionsIsSame: () => conditionsIsSame,
47
50
  convertSettings: () => convertSettings,
@@ -53,6 +56,9 @@ __export(src_exports, {
53
56
  document: () => document,
54
57
  evalCode: () => evalCode,
55
58
  fetch: () => fetch,
59
+ filterAutoStartContent: () => filterAutoStartContent,
60
+ flowIsDismissed: () => flowIsDismissed,
61
+ flowIsSeen: () => flowIsSeen,
56
62
  formatDate: () => formatDate,
57
63
  generateAutoStateColors: () => generateAutoStateColors,
58
64
  getAuthToken: () => getAuthToken,
@@ -75,6 +81,7 @@ __export(src_exports, {
75
81
  hexToHSLString: () => hexToHSLString,
76
82
  hexToRGBStr: () => hexToRGBStr,
77
83
  hexToRgb: () => hexToRgb,
84
+ isActiveRulesByCurrentTime: () => isActiveRulesByCurrentTime,
78
85
  isArray: () => isArray,
79
86
  isBoolean: () => isBoolean,
80
87
  isDark: () => isDark,
@@ -97,12 +104,14 @@ __export(src_exports, {
97
104
  isUint8Array: () => isUint8Array,
98
105
  isUndefined: () => isUndefined,
99
106
  isUrl: () => isUrl,
107
+ isValidContent: () => isValidContent,
100
108
  isValidSelector: () => isValidSelector,
101
- location: () => location,
109
+ location: () => location2,
102
110
  mergeThemeDefaultSettings: () => mergeThemeDefaultSettings,
103
111
  nativeForEach: () => nativeForEach,
104
112
  nativeIndexOf: () => nativeIndexOf,
105
113
  navigator: () => navigator,
114
+ parseUrlParams: () => parseUrlParams,
106
115
  removeAuthToken: () => removeAuthToken,
107
116
  setAuthToken: () => setAuthToken,
108
117
  storage: () => storage,
@@ -812,7 +821,7 @@ var nativeForEach = ArrayProto.forEach;
812
821
  var nativeIndexOf = ArrayProto.indexOf;
813
822
  var navigator = global == null ? void 0 : global.navigator;
814
823
  var document = global == null ? void 0 : global.document;
815
- var location = global == null ? void 0 : global.location;
824
+ var location2 = global == null ? void 0 : global.location;
816
825
  var fetch = global == null ? void 0 : global.fetch;
817
826
  var XMLHttpRequest = (global == null ? void 0 : global.XMLHttpRequest) && "withCredentials" in new global.XMLHttpRequest() ? global.XMLHttpRequest : void 0;
818
827
  var AbortController = global == null ? void 0 : global.AbortController;
@@ -1086,15 +1095,335 @@ var getRandomColor = () => {
1086
1095
  ];
1087
1096
  return colors[Math.floor(Math.random() * colors.length)];
1088
1097
  };
1098
+
1099
+ // src/conditions.ts
1100
+ var import_types4 = require("@usertour/types");
1101
+ var import_date_fns = require("date-fns");
1102
+ var PRIORITIES = [
1103
+ import_types4.ContentPriority.HIGHEST,
1104
+ import_types4.ContentPriority.HIGH,
1105
+ import_types4.ContentPriority.MEDIUM,
1106
+ import_types4.ContentPriority.LOW,
1107
+ import_types4.ContentPriority.LOWEST
1108
+ ];
1109
+ var rulesTypes = Object.values(import_types4.RulesType);
1110
+ var isActiveRulesByCurrentTime = (rules) => {
1111
+ const { endDate, endDateHour, endDateMinute, startDate, startDateHour, startDateMinute } = rules.data;
1112
+ const startTime = /* @__PURE__ */ new Date(`${startDate} ${startDateHour}:${startDateMinute}:00`);
1113
+ const endTime = /* @__PURE__ */ new Date(`${endDate} ${endDateHour}:${endDateMinute}:00`);
1114
+ const now = /* @__PURE__ */ new Date();
1115
+ if (!endDate) {
1116
+ return (0, import_date_fns.isAfter)(now, startTime);
1117
+ }
1118
+ return (0, import_date_fns.isAfter)(now, startTime) && (0, import_date_fns.isBefore)(now, endTime);
1119
+ };
1120
+ var isActivedContentRulesCondition = (rules, contentSession) => {
1121
+ const { contentId, logic } = rules.data;
1122
+ const { latestSession, seenSessions, completedSessions } = contentSession;
1123
+ if (!contentId || !logic || contentId !== contentSession.contentId) {
1124
+ return false;
1125
+ }
1126
+ if (logic === import_types4.ContentConditionLogic.ACTIVED || logic === import_types4.ContentConditionLogic.UNACTIVED) {
1127
+ if (!latestSession) {
1128
+ return logic === import_types4.ContentConditionLogic.UNACTIVED;
1129
+ }
1130
+ const isActived = !(flowIsDismissed(latestSession) || checklistIsDimissed(latestSession));
1131
+ return logic === import_types4.ContentConditionLogic.ACTIVED ? isActived : !isActived;
1132
+ }
1133
+ const isSeen = seenSessions > 0;
1134
+ const isCompleted = completedSessions > 0;
1135
+ if (logic === import_types4.ContentConditionLogic.SEEN || logic === import_types4.ContentConditionLogic.UNSEEN) {
1136
+ return logic === import_types4.ContentConditionLogic.SEEN ? isSeen : !isSeen;
1137
+ }
1138
+ if (logic === import_types4.ContentConditionLogic.COMPLETED || logic === import_types4.ContentConditionLogic.UNCOMPLETED) {
1139
+ return logic === import_types4.ContentConditionLogic.COMPLETED ? isCompleted : !isCompleted;
1140
+ }
1141
+ return false;
1142
+ };
1143
+ var activedContentRulesConditions = async (conditions, contents) => {
1144
+ const rulesCondition = [...conditions];
1145
+ for (let j = 0; j < rulesCondition.length; j++) {
1146
+ const rules = rulesCondition[j];
1147
+ if (rules.type !== "group") {
1148
+ if (rules.type === import_types4.RulesType.CONTENT) {
1149
+ const content = contents.find((c) => c.contentId === rules.data.contentId);
1150
+ if (content) {
1151
+ const contentSession = {
1152
+ contentId: content.contentId,
1153
+ latestSession: content.latestSession,
1154
+ totalSessions: content.totalSessions,
1155
+ dismissedSessions: content.dismissedSessions,
1156
+ completedSessions: content.completedSessions,
1157
+ seenSessions: content.seenSessions
1158
+ };
1159
+ rulesCondition[j].actived = isActivedContentRulesCondition(rules, contentSession);
1160
+ }
1161
+ }
1162
+ } else if (rules.conditions) {
1163
+ rulesCondition[j].conditions = await activedContentRulesConditions(
1164
+ rules.conditions,
1165
+ contents
1166
+ );
1167
+ }
1168
+ }
1169
+ return rulesCondition;
1170
+ };
1171
+ var isActive = (autoStartRules) => {
1172
+ if (!autoStartRules || autoStartRules.length === 0) {
1173
+ return false;
1174
+ }
1175
+ const operator = autoStartRules[0].operators;
1176
+ const actives = autoStartRules.filter((rule) => {
1177
+ if (!rule.conditions) {
1178
+ return rule.actived;
1179
+ }
1180
+ return isActive(rule.conditions);
1181
+ });
1182
+ return operator === "and" ? actives.length === autoStartRules.length : actives.length > 0;
1183
+ };
1184
+ var isActiveContent = (content) => {
1185
+ const { enabledAutoStartRules, autoStartRules } = content.config;
1186
+ if (!enabledAutoStartRules || !isActive(autoStartRules)) {
1187
+ return false;
1188
+ }
1189
+ return true;
1190
+ };
1191
+ var priorityCompare = (a, b) => {
1192
+ var _a, _b, _c, _d;
1193
+ const a1 = (_b = (_a = a == null ? void 0 : a.config) == null ? void 0 : _a.autoStartRulesSetting) == null ? void 0 : _b.priority;
1194
+ const a2 = (_d = (_c = b == null ? void 0 : b.config) == null ? void 0 : _c.autoStartRulesSetting) == null ? void 0 : _d.priority;
1195
+ if (!a1 || !a2) {
1196
+ return 0;
1197
+ }
1198
+ const index1 = PRIORITIES.indexOf(a1);
1199
+ const index2 = PRIORITIES.indexOf(a2);
1200
+ if (index1 > index2) {
1201
+ return 1;
1202
+ }
1203
+ if (index1 < index2) {
1204
+ return -1;
1205
+ }
1206
+ return 0;
1207
+ };
1208
+ var filterAutoStartContent = (contents, type) => {
1209
+ return contents.filter((content) => {
1210
+ const isActive2 = isActiveContent(content);
1211
+ const isValid = isValidContent(content, contents);
1212
+ return content.type === type && isActive2 && isValid;
1213
+ }).sort(priorityCompare);
1214
+ };
1215
+ var getLatestEvent = (currentContent, contents, eventCodeName) => {
1216
+ var _a;
1217
+ const bizEvents = [];
1218
+ const contentId = currentContent.id;
1219
+ const contentType = currentContent.type;
1220
+ for (let index = 0; index < contents.length; index++) {
1221
+ const content = contents[index];
1222
+ if (content.id === contentId || content.type !== contentType) {
1223
+ continue;
1224
+ }
1225
+ const sessionBizEvents = (_a = content.latestSession) == null ? void 0 : _a.bizEvent;
1226
+ if (sessionBizEvents && sessionBizEvents.length > 0) {
1227
+ bizEvents.push(...sessionBizEvents.filter((e) => {
1228
+ var _a2;
1229
+ return ((_a2 = e == null ? void 0 : e.event) == null ? void 0 : _a2.codeName) === eventCodeName;
1230
+ }));
1231
+ }
1232
+ }
1233
+ return findLatestEvent(bizEvents);
1234
+ };
1235
+ var findLatestEvent = (bizEvents) => {
1236
+ const initialValue = bizEvents[0];
1237
+ const lastEvent = bizEvents.reduce(
1238
+ (accumulator, currentValue) => {
1239
+ if ((0, import_date_fns.isAfter)(new Date(currentValue.createdAt), new Date(accumulator.createdAt))) {
1240
+ return currentValue;
1241
+ }
1242
+ return accumulator;
1243
+ },
1244
+ initialValue
1245
+ );
1246
+ return lastEvent;
1247
+ };
1248
+ var completeEventMapping = {
1249
+ [import_types4.ContentDataType.FLOW]: import_types4.BizEvents.FLOW_COMPLETED,
1250
+ [import_types4.ContentDataType.LAUNCHER]: import_types4.BizEvents.LAUNCHER_ACTIVATED,
1251
+ [import_types4.ContentDataType.CHECKLIST]: import_types4.BizEvents.CHECKLIST_COMPLETED
1252
+ };
1253
+ var showEventMapping = {
1254
+ [import_types4.ContentDataType.FLOW]: import_types4.BizEvents.FLOW_STEP_SEEN,
1255
+ [import_types4.ContentDataType.LAUNCHER]: import_types4.BizEvents.LAUNCHER_SEEN,
1256
+ [import_types4.ContentDataType.CHECKLIST]: import_types4.BizEvents.CHECKLIST_SEEN
1257
+ };
1258
+ var isDismissedEventMapping = {
1259
+ [import_types4.ContentDataType.FLOW]: import_types4.BizEvents.FLOW_ENDED,
1260
+ [import_types4.ContentDataType.LAUNCHER]: import_types4.BizEvents.LAUNCHER_DISMISSED,
1261
+ [import_types4.ContentDataType.CHECKLIST]: import_types4.BizEvents.CHECKLIST_DISMISSED
1262
+ };
1263
+ var isGreaterThenDuration = (dateLeft, dateRight, unit, duration) => {
1264
+ switch (unit) {
1265
+ case import_types4.FrequencyUnits.SECONDS: {
1266
+ if ((0, import_date_fns.differenceInSeconds)(dateLeft, dateRight) >= duration) {
1267
+ return true;
1268
+ }
1269
+ return false;
1270
+ }
1271
+ case import_types4.FrequencyUnits.MINUTES:
1272
+ if ((0, import_date_fns.differenceInMinutes)(dateLeft, dateRight) >= duration) {
1273
+ return true;
1274
+ }
1275
+ return false;
1276
+ case import_types4.FrequencyUnits.HOURS:
1277
+ if ((0, import_date_fns.differenceInHours)(dateLeft, dateRight) >= duration) {
1278
+ return true;
1279
+ }
1280
+ return false;
1281
+ case import_types4.FrequencyUnits.DAYES:
1282
+ if ((0, import_date_fns.differenceInDays)(dateLeft, dateRight) >= duration) {
1283
+ return true;
1284
+ }
1285
+ return false;
1286
+ default:
1287
+ return false;
1288
+ }
1289
+ };
1290
+ var checklistIsDimissed = (latestSession) => {
1291
+ var _a;
1292
+ return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find(
1293
+ (event) => {
1294
+ var _a2;
1295
+ return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === import_types4.BizEvents.CHECKLIST_DISMISSED;
1296
+ }
1297
+ );
1298
+ };
1299
+ var flowIsDismissed = (latestSession) => {
1300
+ var _a;
1301
+ return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find((event) => {
1302
+ var _a2;
1303
+ return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === import_types4.BizEvents.FLOW_ENDED;
1304
+ });
1305
+ };
1306
+ var flowIsSeen = (latestSession) => {
1307
+ var _a;
1308
+ return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find(
1309
+ (event) => {
1310
+ var _a2;
1311
+ return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === import_types4.BizEvents.FLOW_STEP_SEEN;
1312
+ }
1313
+ );
1314
+ };
1315
+ var checklistIsSeen = (latestSession) => {
1316
+ var _a;
1317
+ return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find(
1318
+ (event) => {
1319
+ var _a2;
1320
+ return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === import_types4.BizEvents.CHECKLIST_SEEN;
1321
+ }
1322
+ );
1323
+ };
1324
+ var isValidContent = (content, contents) => {
1325
+ var _a;
1326
+ const now = /* @__PURE__ */ new Date();
1327
+ if (content.type === import_types4.ContentDataType.FLOW) {
1328
+ if (!content.steps || content.steps.length === 0) {
1329
+ return false;
1330
+ }
1331
+ } else {
1332
+ if (!content.data) {
1333
+ return false;
1334
+ }
1335
+ }
1336
+ if (!content.config.autoStartRulesSetting) {
1337
+ return true;
1338
+ }
1339
+ const { frequency, startIfNotComplete } = content.config.autoStartRulesSetting;
1340
+ const completedSessions = content.completedSessions;
1341
+ const dismissedSessions = content.dismissedSessions;
1342
+ if (startIfNotComplete && completedSessions > 0) {
1343
+ return false;
1344
+ }
1345
+ if (!frequency) {
1346
+ return true;
1347
+ }
1348
+ const contentType = content.type;
1349
+ const lastEventName = showEventMapping[contentType];
1350
+ const lastEvent = getLatestEvent(content, contents, lastEventName);
1351
+ const contentEvents = (_a = content.latestSession) == null ? void 0 : _a.bizEvent;
1352
+ if (lastEvent && frequency && frequency.atLeast && !isGreaterThenDuration(
1353
+ now,
1354
+ new Date(lastEvent.createdAt),
1355
+ frequency.atLeast.unit,
1356
+ frequency.atLeast.duration
1357
+ )) {
1358
+ return false;
1359
+ }
1360
+ if (frequency.frequency === import_types4.Frequency.ONCE) {
1361
+ if (dismissedSessions > 0) {
1362
+ return false;
1363
+ }
1364
+ return true;
1365
+ }
1366
+ const showEventName = showEventMapping[contentType];
1367
+ const showEvents = contentEvents == null ? void 0 : contentEvents.filter(
1368
+ (e) => {
1369
+ var _a2, _b;
1370
+ return ((_a2 = e == null ? void 0 : e.event) == null ? void 0 : _a2.codeName) === showEventName && (contentType === import_types4.ContentDataType.FLOW ? ((_b = e == null ? void 0 : e.data) == null ? void 0 : _b.flow_step_number) === 0 : true);
1371
+ }
1372
+ );
1373
+ if (!showEvents || showEvents.length === 0) {
1374
+ return true;
1375
+ }
1376
+ const lastShowEvent = findLatestEvent(showEvents);
1377
+ const lastShowEventDate = new Date(lastShowEvent.createdAt);
1378
+ if (frequency.frequency === import_types4.Frequency.MULTIPLE) {
1379
+ if (frequency.every.times && dismissedSessions >= frequency.every.times) {
1380
+ return false;
1381
+ }
1382
+ }
1383
+ if (frequency.frequency === import_types4.Frequency.MULTIPLE || frequency.frequency === import_types4.Frequency.UNLIMITED) {
1384
+ if (!isGreaterThenDuration(now, lastShowEventDate, frequency.every.unit, frequency.every.duration)) {
1385
+ return false;
1386
+ }
1387
+ }
1388
+ return true;
1389
+ };
1390
+ var parseUrlParams = (url, paramName) => {
1391
+ if (!url || !paramName) {
1392
+ return null;
1393
+ }
1394
+ try {
1395
+ const urlObj = new URL(url);
1396
+ const searchParams = new URLSearchParams(urlObj.search);
1397
+ if (searchParams.has(paramName)) {
1398
+ return searchParams.get(paramName);
1399
+ }
1400
+ if (urlObj.hash) {
1401
+ const hashSearch = urlObj.hash.split("?")[1];
1402
+ if (hashSearch) {
1403
+ const hashParams = new URLSearchParams(hashSearch);
1404
+ if (hashParams.has(paramName)) {
1405
+ return hashParams.get(paramName);
1406
+ }
1407
+ }
1408
+ }
1409
+ return null;
1410
+ } catch (error) {
1411
+ console.error("Error parsing URL:", error);
1412
+ return null;
1413
+ }
1414
+ };
1089
1415
  // Annotate the CommonJS export names for ESM import in node:
1090
1416
  0 && (module.exports = {
1091
1417
  AbortController,
1092
1418
  ArrayProto,
1093
1419
  XMLHttpRequest,
1094
1420
  absoluteUrl,
1421
+ activedContentRulesConditions,
1095
1422
  assignableWindow,
1096
1423
  autoStartConditions,
1097
1424
  buildConfig,
1425
+ checklistIsDimissed,
1426
+ checklistIsSeen,
1098
1427
  cn,
1099
1428
  conditionsIsSame,
1100
1429
  convertSettings,
@@ -1106,6 +1435,9 @@ var getRandomColor = () => {
1106
1435
  document,
1107
1436
  evalCode,
1108
1437
  fetch,
1438
+ filterAutoStartContent,
1439
+ flowIsDismissed,
1440
+ flowIsSeen,
1109
1441
  formatDate,
1110
1442
  generateAutoStateColors,
1111
1443
  getAuthToken,
@@ -1128,6 +1460,7 @@ var getRandomColor = () => {
1128
1460
  hexToHSLString,
1129
1461
  hexToRGBStr,
1130
1462
  hexToRgb,
1463
+ isActiveRulesByCurrentTime,
1131
1464
  isArray,
1132
1465
  isBoolean,
1133
1466
  isDark,
@@ -1150,12 +1483,14 @@ var getRandomColor = () => {
1150
1483
  isUint8Array,
1151
1484
  isUndefined,
1152
1485
  isUrl,
1486
+ isValidContent,
1153
1487
  isValidSelector,
1154
1488
  location,
1155
1489
  mergeThemeDefaultSettings,
1156
1490
  nativeForEach,
1157
1491
  nativeIndexOf,
1158
1492
  navigator,
1493
+ parseUrlParams,
1159
1494
  removeAuthToken,
1160
1495
  setAuthToken,
1161
1496
  storage,
package/dist/index.d.cts CHANGED
@@ -11,6 +11,7 @@ export { isPublishedAtLeastOneEnvironment, isPublishedInAllEnvironments } from '
11
11
  export { deepClone } from './utils.cjs';
12
12
  export { generateAutoStateColors, hexToHSLString, hexToRGBStr } from './color.cjs';
13
13
  export { absoluteUrl, cn, cuid, evalCode, formatDate, getRandomColor, hexToRgb, isDark, uuidV4 } from './helper.cjs';
14
+ export { activedContentRulesConditions, checklistIsDimissed, checklistIsSeen, filterAutoStartContent, flowIsDismissed, flowIsSeen, isActiveRulesByCurrentTime, isValidContent, parseUrlParams } from './conditions.cjs';
14
15
  export { default as isEqual } from 'fast-deep-equal';
15
16
  import '@usertour/types';
16
17
  import './storage.cjs';
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { isPublishedAtLeastOneEnvironment, isPublishedInAllEnvironments } from '
11
11
  export { deepClone } from './utils.js';
12
12
  export { generateAutoStateColors, hexToHSLString, hexToRGBStr } from './color.js';
13
13
  export { absoluteUrl, cn, cuid, evalCode, formatDate, getRandomColor, hexToRgb, isDark, uuidV4 } from './helper.js';
14
+ export { activedContentRulesConditions, checklistIsDimissed, checklistIsSeen, filterAutoStartContent, flowIsDismissed, flowIsSeen, isActiveRulesByCurrentTime, isValidContent, parseUrlParams } from './conditions.js';
14
15
  export { default as isEqual } from 'fast-deep-equal';
15
16
  import '@usertour/types';
16
17
  import './storage.js';
package/dist/index.js CHANGED
@@ -25,6 +25,31 @@ import {
25
25
  storage
26
26
  } from "./chunk-FGFMTWFT.js";
27
27
  import "./chunk-3ZGH3NRU.js";
28
+ import {
29
+ AbortController,
30
+ ArrayProto,
31
+ XMLHttpRequest,
32
+ assignableWindow,
33
+ document,
34
+ fetch,
35
+ location,
36
+ nativeForEach,
37
+ nativeIndexOf,
38
+ navigator,
39
+ userAgent,
40
+ win
41
+ } from "./chunk-H7VA3ML2.js";
42
+ import {
43
+ activedContentRulesConditions,
44
+ checklistIsDimissed,
45
+ checklistIsSeen,
46
+ filterAutoStartContent,
47
+ flowIsDismissed,
48
+ flowIsSeen,
49
+ isActiveRulesByCurrentTime,
50
+ isValidContent,
51
+ parseUrlParams
52
+ } from "./chunk-SYVTGB2A.js";
28
53
  import {
29
54
  conditionsIsSame,
30
55
  isEqual,
@@ -85,29 +110,18 @@ import {
85
110
  hasError,
86
111
  isValidSelector
87
112
  } from "./chunk-G5P7KULU.js";
88
- import {
89
- AbortController,
90
- ArrayProto,
91
- XMLHttpRequest,
92
- assignableWindow,
93
- document,
94
- fetch,
95
- location,
96
- nativeForEach,
97
- nativeIndexOf,
98
- navigator,
99
- userAgent,
100
- win
101
- } from "./chunk-H7VA3ML2.js";
102
113
  import "./chunk-XEO3YXBM.js";
103
114
  export {
104
115
  AbortController,
105
116
  ArrayProto,
106
117
  XMLHttpRequest,
107
118
  absoluteUrl,
119
+ activedContentRulesConditions,
108
120
  assignableWindow,
109
121
  autoStartConditions,
110
122
  buildConfig,
123
+ checklistIsDimissed,
124
+ checklistIsSeen,
111
125
  cn,
112
126
  conditionsIsSame,
113
127
  convertSettings,
@@ -119,6 +133,9 @@ export {
119
133
  document,
120
134
  evalCode,
121
135
  fetch,
136
+ filterAutoStartContent,
137
+ flowIsDismissed,
138
+ flowIsSeen,
122
139
  formatDate,
123
140
  generateAutoStateColors,
124
141
  getAuthToken,
@@ -141,6 +158,7 @@ export {
141
158
  hexToHSLString,
142
159
  hexToRGBStr,
143
160
  hexToRgb,
161
+ isActiveRulesByCurrentTime,
144
162
  isArray,
145
163
  isBoolean,
146
164
  isDark,
@@ -163,12 +181,14 @@ export {
163
181
  isUint8Array,
164
182
  isUndefined,
165
183
  isUrl,
184
+ isValidContent,
166
185
  isValidSelector,
167
186
  location,
168
187
  mergeThemeDefaultSettings,
169
188
  nativeForEach,
170
189
  nativeIndexOf,
171
190
  navigator,
191
+ parseUrlParams,
172
192
  removeAuthToken,
173
193
  setAuthToken,
174
194
  storage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usertour/helpers",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "description": "Utility functions and helpers shared across the UserTour project",
6
6
  "homepage": "https://www.usertour.io",
@@ -26,7 +26,7 @@
26
26
  "prepublishOnly": "pnpm build"
27
27
  },
28
28
  "dependencies": {
29
- "@usertour/types": "^0.0.4",
29
+ "@usertour/types": "^0.0.6",
30
30
  "fast-deep-equal": "^3.1.3",
31
31
  "chroma-js": "^3.1.2",
32
32
  "deepmerge-ts": "^7.1.3",
@@ -34,6 +34,7 @@
34
34
  "class-variance-authority": "^0.4.0",
35
35
  "clsx": "^1.2.1",
36
36
  "tailwind-merge": "^1.13.2",
37
+ "date-fns": "^2.30.0",
37
38
  "uuid": "^9.0.1"
38
39
  },
39
40
  "devDependencies": {