@usertour/helpers 0.0.13 → 0.0.15

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.
@@ -1,462 +0,0 @@
1
- import {
2
- conditionsIsSame,
3
- isMatchUrlPattern
4
- } from "./chunk-FNQIIEWK.js";
5
-
6
- // src/conditions.ts
7
- import {
8
- BizEvents,
9
- ContentDataType,
10
- ContentConditionLogic,
11
- Frequency,
12
- FrequencyUnits,
13
- ContentPriority,
14
- RulesType
15
- } from "@usertour/types";
16
- import {
17
- differenceInDays,
18
- differenceInHours,
19
- differenceInMinutes,
20
- differenceInSeconds,
21
- isAfter,
22
- isBefore
23
- } from "date-fns";
24
- var PRIORITIES = [
25
- ContentPriority.HIGHEST,
26
- ContentPriority.HIGH,
27
- ContentPriority.MEDIUM,
28
- ContentPriority.LOW,
29
- ContentPriority.LOWEST
30
- ];
31
- var rulesTypes = Object.values(RulesType);
32
- var isActiveRulesByCurrentPage = (rules) => {
33
- const { excludes, includes } = rules.data;
34
- if (location) {
35
- const href = location.href;
36
- return isMatchUrlPattern(href, includes, excludes);
37
- }
38
- return false;
39
- };
40
- var isActiveRulesByCurrentTime = (rules) => {
41
- const { endDate, endDateHour, endDateMinute, startDate, startDateHour, startDateMinute } = rules.data;
42
- const startTime = /* @__PURE__ */ new Date(`${startDate} ${startDateHour}:${startDateMinute}:00`);
43
- const endTime = /* @__PURE__ */ new Date(`${endDate} ${endDateHour}:${endDateMinute}:00`);
44
- const now = /* @__PURE__ */ new Date();
45
- if (!endDate) {
46
- return isAfter(now, startTime);
47
- }
48
- return isAfter(now, startTime) && isBefore(now, endTime);
49
- };
50
- var isActivedContentRulesCondition = (rules, contentSession) => {
51
- const { contentId, logic } = rules.data;
52
- const { latestSession, seenSessions, completedSessions } = contentSession;
53
- if (!contentId || !logic || contentId !== contentSession.contentId) {
54
- return false;
55
- }
56
- if (logic === ContentConditionLogic.ACTIVED || logic === ContentConditionLogic.UNACTIVED) {
57
- if (!latestSession) {
58
- return logic === ContentConditionLogic.UNACTIVED;
59
- }
60
- const isActived = !(flowIsDismissed(latestSession) || checklistIsDimissed(latestSession));
61
- return logic === ContentConditionLogic.ACTIVED ? isActived : !isActived;
62
- }
63
- const isSeen = seenSessions > 0;
64
- const isCompleted = completedSessions > 0;
65
- if (logic === ContentConditionLogic.SEEN || logic === ContentConditionLogic.UNSEEN) {
66
- return logic === ContentConditionLogic.SEEN ? isSeen : !isSeen;
67
- }
68
- if (logic === ContentConditionLogic.COMPLETED || logic === ContentConditionLogic.UNCOMPLETED) {
69
- return logic === ContentConditionLogic.COMPLETED ? isCompleted : !isCompleted;
70
- }
71
- return false;
72
- };
73
- var isValidRulesType = (type) => {
74
- return rulesTypes.includes(type);
75
- };
76
- var isActiveRules = async (rules) => {
77
- if (!isValidRulesType(rules.type)) {
78
- return true;
79
- }
80
- switch (rules.type) {
81
- case RulesType.CURRENT_PAGE:
82
- return isActiveRulesByCurrentPage(rules);
83
- case RulesType.TIME:
84
- return isActiveRulesByCurrentTime(rules);
85
- default:
86
- return rules.actived;
87
- }
88
- };
89
- var activedRulesConditions = async (conditions, rewrite) => {
90
- const rulesCondition = [...conditions];
91
- for (let j = 0; j < rulesCondition.length; j++) {
92
- const rules = rulesCondition[j];
93
- if (rules.type !== "group") {
94
- if (rewrite == null ? void 0 : rewrite[rules.type]) {
95
- rulesCondition[j].actived = true;
96
- } else {
97
- rulesCondition[j].actived = await isActiveRules(rules);
98
- }
99
- } else if (rules.conditions) {
100
- rulesCondition[j].conditions = await activedRulesConditions(rules.conditions);
101
- }
102
- }
103
- return rulesCondition;
104
- };
105
- var activedContentRulesConditions = async (conditions, contents) => {
106
- const rulesCondition = [...conditions];
107
- for (let j = 0; j < rulesCondition.length; j++) {
108
- const rules = rulesCondition[j];
109
- if (rules.type !== "group") {
110
- if (rules.type === RulesType.CONTENT) {
111
- const content = contents.find((c) => c.contentId === rules.data.contentId);
112
- if (content) {
113
- const contentSession = {
114
- contentId: content.contentId,
115
- latestSession: content.latestSession,
116
- totalSessions: content.totalSessions,
117
- dismissedSessions: content.dismissedSessions,
118
- completedSessions: content.completedSessions,
119
- seenSessions: content.seenSessions
120
- };
121
- rulesCondition[j].actived = isActivedContentRulesCondition(rules, contentSession);
122
- }
123
- }
124
- } else if (rules.conditions) {
125
- rulesCondition[j].conditions = await activedContentRulesConditions(
126
- rules.conditions,
127
- contents
128
- );
129
- }
130
- }
131
- return rulesCondition;
132
- };
133
- var activedContentCondition = async (contents) => {
134
- const _contents = JSON.parse(JSON.stringify(contents));
135
- for (let index = 0; index < _contents.length; index++) {
136
- const content = _contents[index];
137
- const { enabledAutoStartRules, autoStartRules, hideRules, enabledHideRules } = content.config;
138
- if (enabledAutoStartRules && autoStartRules && autoStartRules.length > 0) {
139
- content.config.autoStartRules = await activedRulesConditions(autoStartRules);
140
- }
141
- if (enabledHideRules && hideRules && hideRules.length > 0) {
142
- content.config.hideRules = await activedRulesConditions(hideRules);
143
- }
144
- }
145
- return _contents;
146
- };
147
- var isActive = (autoStartRules) => {
148
- if (!autoStartRules || autoStartRules.length === 0) {
149
- return false;
150
- }
151
- const operator = autoStartRules[0].operators;
152
- const actives = autoStartRules.filter((rule) => {
153
- if (!rule.conditions) {
154
- return rule.actived;
155
- }
156
- return isActive(rule.conditions);
157
- });
158
- return operator === "and" ? actives.length === autoStartRules.length : actives.length > 0;
159
- };
160
- var isActiveContent = (content) => {
161
- const { enabledAutoStartRules, autoStartRules } = content.config;
162
- if (!enabledAutoStartRules || !isActive(autoStartRules)) {
163
- return false;
164
- }
165
- return true;
166
- };
167
- var priorityCompare = (a, b) => {
168
- var _a, _b, _c, _d;
169
- const a1 = (_b = (_a = a == null ? void 0 : a.config) == null ? void 0 : _a.autoStartRulesSetting) == null ? void 0 : _b.priority;
170
- const a2 = (_d = (_c = b == null ? void 0 : b.config) == null ? void 0 : _c.autoStartRulesSetting) == null ? void 0 : _d.priority;
171
- if (!a1 || !a2) {
172
- return 0;
173
- }
174
- const index1 = PRIORITIES.indexOf(a1);
175
- const index2 = PRIORITIES.indexOf(a2);
176
- if (index1 > index2) {
177
- return 1;
178
- }
179
- if (index1 < index2) {
180
- return -1;
181
- }
182
- return 0;
183
- };
184
- var filterAutoStartContent = (contents, type) => {
185
- return contents.filter((content) => {
186
- const isActive2 = isActiveContent(content);
187
- const isValid = isValidContent(content, contents);
188
- return content.type === type && isActive2 && isValid;
189
- }).sort(priorityCompare);
190
- };
191
- var isHasActivedContents = (source, dest) => {
192
- for (let index = 0; index < source.length; index++) {
193
- const content1 = source[index];
194
- const content2 = dest.find((c) => c.id === content1.id);
195
- if (!content2) {
196
- return true;
197
- }
198
- if (isActiveContent(content1) !== isActiveContent(content2)) {
199
- return true;
200
- }
201
- }
202
- return false;
203
- };
204
- var isSameContents = (source, dest) => {
205
- if (!source || !dest || source.length !== dest.length) {
206
- return false;
207
- }
208
- for (let index = 0; index < source.length; index++) {
209
- const content1 = source[index];
210
- const content2 = dest.find((c) => c.id === content1.id);
211
- if (!content2) {
212
- return false;
213
- }
214
- if (!conditionsIsSame(content1.config.autoStartRules, content2.config.autoStartRules)) {
215
- return false;
216
- }
217
- }
218
- return true;
219
- };
220
- var getLatestEvent = (currentContent, contents, eventCodeName) => {
221
- var _a;
222
- const bizEvents = [];
223
- const contentId = currentContent.id;
224
- const contentType = currentContent.type;
225
- for (let index = 0; index < contents.length; index++) {
226
- const content = contents[index];
227
- if (content.id === contentId || content.type !== contentType) {
228
- continue;
229
- }
230
- const sessionBizEvents = (_a = content.latestSession) == null ? void 0 : _a.bizEvent;
231
- if (sessionBizEvents && sessionBizEvents.length > 0) {
232
- bizEvents.push(...sessionBizEvents.filter((e) => {
233
- var _a2;
234
- return ((_a2 = e == null ? void 0 : e.event) == null ? void 0 : _a2.codeName) === eventCodeName;
235
- }));
236
- }
237
- }
238
- return findLatestEvent(bizEvents);
239
- };
240
- var findLatestEvent = (bizEvents) => {
241
- const initialValue = bizEvents[0];
242
- const lastEvent = bizEvents.reduce(
243
- (accumulator, currentValue) => {
244
- if (isAfter(new Date(currentValue.createdAt), new Date(accumulator.createdAt))) {
245
- return currentValue;
246
- }
247
- return accumulator;
248
- },
249
- initialValue
250
- );
251
- return lastEvent;
252
- };
253
- var completeEventMapping = {
254
- [ContentDataType.FLOW]: BizEvents.FLOW_COMPLETED,
255
- [ContentDataType.LAUNCHER]: BizEvents.LAUNCHER_ACTIVATED,
256
- [ContentDataType.CHECKLIST]: BizEvents.CHECKLIST_COMPLETED
257
- };
258
- var showEventMapping = {
259
- [ContentDataType.FLOW]: BizEvents.FLOW_STEP_SEEN,
260
- [ContentDataType.LAUNCHER]: BizEvents.LAUNCHER_SEEN,
261
- [ContentDataType.CHECKLIST]: BizEvents.CHECKLIST_SEEN
262
- };
263
- var isDismissedEventMapping = {
264
- [ContentDataType.FLOW]: BizEvents.FLOW_ENDED,
265
- [ContentDataType.LAUNCHER]: BizEvents.LAUNCHER_DISMISSED,
266
- [ContentDataType.CHECKLIST]: BizEvents.CHECKLIST_DISMISSED
267
- };
268
- var isGreaterThenDuration = (dateLeft, dateRight, unit, duration) => {
269
- switch (unit) {
270
- case FrequencyUnits.SECONDS: {
271
- if (differenceInSeconds(dateLeft, dateRight) >= duration) {
272
- return true;
273
- }
274
- return false;
275
- }
276
- case FrequencyUnits.MINUTES:
277
- if (differenceInMinutes(dateLeft, dateRight) >= duration) {
278
- return true;
279
- }
280
- return false;
281
- case FrequencyUnits.HOURS:
282
- if (differenceInHours(dateLeft, dateRight) >= duration) {
283
- return true;
284
- }
285
- return false;
286
- case FrequencyUnits.DAYES:
287
- if (differenceInDays(dateLeft, dateRight) >= duration) {
288
- return true;
289
- }
290
- return false;
291
- default:
292
- return false;
293
- }
294
- };
295
- var checklistIsDimissed = (latestSession) => {
296
- var _a;
297
- return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find(
298
- (event) => {
299
- var _a2;
300
- return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === BizEvents.CHECKLIST_DISMISSED;
301
- }
302
- );
303
- };
304
- var flowIsDismissed = (latestSession) => {
305
- var _a;
306
- return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find((event) => {
307
- var _a2;
308
- return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === BizEvents.FLOW_ENDED;
309
- });
310
- };
311
- var flowIsSeen = (latestSession) => {
312
- var _a;
313
- return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find(
314
- (event) => {
315
- var _a2;
316
- return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === BizEvents.FLOW_STEP_SEEN;
317
- }
318
- );
319
- };
320
- var checklistIsSeen = (latestSession) => {
321
- var _a;
322
- return (_a = latestSession == null ? void 0 : latestSession.bizEvent) == null ? void 0 : _a.find(
323
- (event) => {
324
- var _a2;
325
- return ((_a2 = event == null ? void 0 : event.event) == null ? void 0 : _a2.codeName) === BizEvents.CHECKLIST_SEEN;
326
- }
327
- );
328
- };
329
- var isValidContent = (content, contents) => {
330
- var _a;
331
- const now = /* @__PURE__ */ new Date();
332
- if (content.type === ContentDataType.FLOW) {
333
- if (!content.steps || content.steps.length === 0) {
334
- return false;
335
- }
336
- } else {
337
- if (!content.data) {
338
- return false;
339
- }
340
- }
341
- if (!content.config.autoStartRulesSetting) {
342
- return true;
343
- }
344
- const { frequency, startIfNotComplete } = content.config.autoStartRulesSetting;
345
- const completedSessions = content.completedSessions;
346
- const dismissedSessions = content.dismissedSessions;
347
- if (startIfNotComplete && completedSessions > 0) {
348
- return false;
349
- }
350
- if (!frequency) {
351
- return true;
352
- }
353
- const contentType = content.type;
354
- const lastEventName = showEventMapping[contentType];
355
- const lastEvent = getLatestEvent(content, contents, lastEventName);
356
- const contentEvents = (_a = content.latestSession) == null ? void 0 : _a.bizEvent;
357
- if (lastEvent && frequency && frequency.atLeast && !isGreaterThenDuration(
358
- now,
359
- new Date(lastEvent.createdAt),
360
- frequency.atLeast.unit,
361
- frequency.atLeast.duration
362
- )) {
363
- return false;
364
- }
365
- if (frequency.frequency === Frequency.ONCE) {
366
- if (dismissedSessions > 0) {
367
- return false;
368
- }
369
- return true;
370
- }
371
- const showEventName = showEventMapping[contentType];
372
- const showEvents = contentEvents == null ? void 0 : contentEvents.filter(
373
- (e) => {
374
- var _a2, _b;
375
- return ((_a2 = e == null ? void 0 : e.event) == null ? void 0 : _a2.codeName) === showEventName && (contentType === ContentDataType.FLOW ? ((_b = e == null ? void 0 : e.data) == null ? void 0 : _b.flow_step_number) === 0 : true);
376
- }
377
- );
378
- if (!showEvents || showEvents.length === 0) {
379
- return true;
380
- }
381
- const lastShowEvent = findLatestEvent(showEvents);
382
- const lastShowEventDate = new Date(lastShowEvent.createdAt);
383
- if (frequency.frequency === Frequency.MULTIPLE) {
384
- if (frequency.every.times && dismissedSessions >= frequency.every.times) {
385
- return false;
386
- }
387
- }
388
- if (frequency.frequency === Frequency.MULTIPLE || frequency.frequency === Frequency.UNLIMITED) {
389
- if (!isGreaterThenDuration(now, lastShowEventDate, frequency.every.unit, frequency.every.duration)) {
390
- return false;
391
- }
392
- }
393
- return true;
394
- };
395
- var parseUrlParams = (url, paramName) => {
396
- if (!url || !paramName) {
397
- return null;
398
- }
399
- try {
400
- const urlObj = new URL(url);
401
- const searchParams = new URLSearchParams(urlObj.search);
402
- if (searchParams.has(paramName)) {
403
- return searchParams.get(paramName);
404
- }
405
- if (urlObj.hash) {
406
- const hashSearch = urlObj.hash.split("?")[1];
407
- if (hashSearch) {
408
- const hashParams = new URLSearchParams(hashSearch);
409
- if (hashParams.has(paramName)) {
410
- return hashParams.get(paramName);
411
- }
412
- }
413
- }
414
- return null;
415
- } catch (error) {
416
- console.error("Error parsing URL:", error);
417
- return null;
418
- }
419
- };
420
- var wait = (seconds) => {
421
- if (typeof seconds !== "number" || Number.isNaN(seconds)) {
422
- return Promise.reject(new Error("Invalid wait time: must be a number"));
423
- }
424
- if (seconds < 0) {
425
- return Promise.reject(new Error("Invalid wait time: cannot be negative"));
426
- }
427
- if (seconds === 0) {
428
- return Promise.resolve();
429
- }
430
- return new Promise((resolve, reject) => {
431
- try {
432
- setTimeout(resolve, seconds * 1e3);
433
- } catch (error) {
434
- reject(error);
435
- }
436
- });
437
- };
438
-
439
- export {
440
- PRIORITIES,
441
- rulesTypes,
442
- isActiveRulesByCurrentPage,
443
- isActiveRulesByCurrentTime,
444
- activedRulesConditions,
445
- activedContentRulesConditions,
446
- activedContentCondition,
447
- isActive,
448
- isActiveContent,
449
- filterAutoStartContent,
450
- isHasActivedContents,
451
- isSameContents,
452
- findLatestEvent,
453
- completeEventMapping,
454
- isDismissedEventMapping,
455
- checklistIsDimissed,
456
- flowIsDismissed,
457
- flowIsSeen,
458
- checklistIsSeen,
459
- isValidContent,
460
- parseUrlParams,
461
- wait
462
- };
@@ -1,157 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/condition.ts
31
- var condition_exports = {};
32
- __export(condition_exports, {
33
- conditionsIsSame: () => conditionsIsSame,
34
- isEqual: () => import_fast_deep_equal.default,
35
- isMatchUrlPattern: () => isMatchUrlPattern
36
- });
37
- module.exports = __toCommonJS(condition_exports);
38
- var import_fast_deep_equal = __toESM(require("fast-deep-equal"), 1);
39
- var parseUrl = (url) => {
40
- const urlPatterns = url.match(/^(([a-z\d]+):\/\/)?([^/?#]+)?(\/[^?#]*)?(\?([^#]*))?(#.*)?$/i);
41
- if (!urlPatterns) {
42
- return null;
43
- }
44
- const [, , scheme = "", domain = "", path = "", , query = "", fragment = ""] = urlPatterns;
45
- return { scheme, domain, path, query, fragment };
46
- };
47
- var replaceWildcard = (input, s1, s2) => {
48
- const withSpecialWords = replaceSpecialWords(input);
49
- const withWildcard = withSpecialWords.replace(/\\\*/g, `${s1}*`);
50
- if (!s2) {
51
- return withWildcard;
52
- }
53
- return withWildcard.replace(/:[a-z0-9_]+/g, `[^${s2}]+`);
54
- };
55
- var replaceSpecialWords = (str) => {
56
- return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
57
- };
58
- var parsePattern = (pattern) => {
59
- if (!pattern || !pattern.trim()) {
60
- return null;
61
- }
62
- const _pattern = parseUrl(pattern);
63
- if (!_pattern) {
64
- console.error("Invalid URL pattern:", pattern);
65
- return null;
66
- }
67
- const { scheme, domain, path, query, fragment } = _pattern;
68
- const _scheme = scheme ? replaceSpecialWords(scheme) : "[a-z\\d]+";
69
- const _domain = domain ? replaceWildcard(domain, "[^/]", ".") : "[^/]*";
70
- const _fragment = fragment ? replaceWildcard(fragment, ".", "/") : "(#.*)?";
71
- const _path = path ? replaceWildcard(path, "[^?#]", "/") : "/[^?#]*";
72
- let _query = "(\\?[^#]*)?";
73
- if (query) {
74
- new URLSearchParams(query).forEach((value, key) => {
75
- const _str = value === "" ? "=?" : value === "*" ? "(=[^&#]*)?" : `=${replaceWildcard(value, "[^#]")}`;
76
- _query += `(?=.*[?&]${replaceSpecialWords(key)}${_str}([&#]|$))`;
77
- });
78
- _query += "\\?[^#]*";
79
- }
80
- return new RegExp(`^${_scheme}://${_domain}(:\\d+)?${_path}${_query}${_fragment}$`);
81
- };
82
- var isMatchUrlPattern = (_url, includes, excludes) => {
83
- const isMatchIncludesConditions = includes.length > 0 ? includes.some((_include) => {
84
- const reg = parsePattern(_include);
85
- if (reg) {
86
- return reg.test(_url);
87
- }
88
- return false;
89
- }) : true;
90
- const isMatchExcludesConditions = excludes.length > 0 ? excludes.some((_exclude) => {
91
- const reg = parsePattern(_exclude);
92
- if (reg) {
93
- return reg.test(_url);
94
- }
95
- return false;
96
- }) : false;
97
- return isMatchIncludesConditions && !isMatchExcludesConditions;
98
- };
99
- var compareConditionsItem = (item1, item2) => {
100
- const { data = {}, ...others1 } = item1;
101
- const { data: data2 = {}, ...others2 } = item2;
102
- if (!(0, import_fast_deep_equal.default)(others2, others1)) {
103
- return false;
104
- }
105
- for (const key in data) {
106
- if (!(0, import_fast_deep_equal.default)(data[key], data2[key])) {
107
- return false;
108
- }
109
- }
110
- return true;
111
- };
112
- var conditionsIsSame = (rr1, rr2) => {
113
- const r1 = [...rr1];
114
- const r2 = [...rr2];
115
- if (r1.length === 0 && r2.length === 0) {
116
- return true;
117
- }
118
- if (r1.length !== r2.length) {
119
- return false;
120
- }
121
- const group1 = r1.filter((item) => item.type === "group");
122
- const group2 = r2.filter((item) => item.type === "group");
123
- if (group1.length !== group2.length) {
124
- return false;
125
- }
126
- for (let index = 0; index < r1.length; index++) {
127
- const item1 = r1[index];
128
- const item2 = r2[index];
129
- if (!item1 || !item2) {
130
- return false;
131
- }
132
- if (item1.type === "group") {
133
- if (!item2.conditions) {
134
- return false;
135
- }
136
- const c1 = item1.conditions;
137
- const c2 = item2.conditions;
138
- if (item1.operators !== item2.operators) {
139
- return false;
140
- }
141
- if (!conditionsIsSame(c1, c2)) {
142
- return false;
143
- }
144
- } else {
145
- if (!compareConditionsItem(item1, item2)) {
146
- return false;
147
- }
148
- }
149
- }
150
- return true;
151
- };
152
- // Annotate the CommonJS export names for ESM import in node:
153
- 0 && (module.exports = {
154
- conditionsIsSame,
155
- isEqual,
156
- isMatchUrlPattern
157
- });
@@ -1,7 +0,0 @@
1
- import { RulesCondition } from '@usertour/types';
2
- export { default as isEqual } from 'fast-deep-equal';
3
-
4
- declare const isMatchUrlPattern: (_url: string, includes: string[], excludes: string[]) => boolean;
5
- declare const conditionsIsSame: (rr1: RulesCondition[], rr2: RulesCondition[]) => boolean;
6
-
7
- export { conditionsIsSame, isMatchUrlPattern };
@@ -1,7 +0,0 @@
1
- import { RulesCondition } from '@usertour/types';
2
- export { default as isEqual } from 'fast-deep-equal';
3
-
4
- declare const isMatchUrlPattern: (_url: string, includes: string[], excludes: string[]) => boolean;
5
- declare const conditionsIsSame: (rr1: RulesCondition[], rr2: RulesCondition[]) => boolean;
6
-
7
- export { conditionsIsSame, isMatchUrlPattern };
package/dist/condition.js DELETED
@@ -1,11 +0,0 @@
1
- import {
2
- conditionsIsSame,
3
- isEqual,
4
- isMatchUrlPattern
5
- } from "./chunk-FNQIIEWK.js";
6
- import "./chunk-XEO3YXBM.js";
7
- export {
8
- conditionsIsSame,
9
- isEqual,
10
- isMatchUrlPattern
11
- };