@usertour/helpers 0.0.43 → 0.0.45

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,63 +0,0 @@
1
- // src/content.ts
2
- import {
3
- ContentPriority
4
- } from "@usertour/types";
5
- import { deepmerge } from "deepmerge-ts";
6
- var isPublishedInAllEnvironments = (content, environmentList, version) => {
7
- var _a;
8
- if (!((_a = content == null ? void 0 : content.contentOnEnvironments) == null ? void 0 : _a.length) || !(environmentList == null ? void 0 : environmentList.length) || !(version == null ? void 0 : version.id)) {
9
- return false;
10
- }
11
- return environmentList.every(
12
- (env) => {
13
- var _a2;
14
- return (_a2 = content == null ? void 0 : content.contentOnEnvironments) == null ? void 0 : _a2.some(
15
- (item) => item.published && item.publishedVersionId === version.id && item.environment.id === env.id
16
- );
17
- }
18
- );
19
- };
20
- var isPublishedAtLeastOneEnvironment = (content) => {
21
- var _a;
22
- if ((content == null ? void 0 : content.contentOnEnvironments) && ((_a = content == null ? void 0 : content.contentOnEnvironments) == null ? void 0 : _a.length) > 0) {
23
- return true;
24
- }
25
- return false;
26
- };
27
- var rulesSetting = {
28
- // frequency: {
29
- // frequency: Frequency.ONCE,
30
- // every: { duration: 0, times: 1, unit: FrequencyUnits.MINUTES },
31
- // atLeast: { duration: 0, unit: FrequencyUnits.MINUTES },
32
- // },
33
- startIfNotComplete: false,
34
- priority: ContentPriority.MEDIUM,
35
- wait: 0
36
- };
37
- var hideRulesSetting = {};
38
- var defaultContentConfig = {
39
- enabledAutoStartRules: false,
40
- enabledHideRules: false,
41
- autoStartRules: [],
42
- hideRules: [],
43
- autoStartRulesSetting: rulesSetting,
44
- hideRulesSetting
45
- };
46
- var buildConfig = (config) => {
47
- return {
48
- ...defaultContentConfig,
49
- ...config,
50
- autoStartRulesSetting: deepmerge(
51
- defaultContentConfig.autoStartRulesSetting,
52
- (config == null ? void 0 : config.autoStartRulesSetting) || {}
53
- ),
54
- hideRulesSetting: (config == null ? void 0 : config.hideRulesSetting) || {}
55
- };
56
- };
57
-
58
- export {
59
- isPublishedInAllEnvironments,
60
- isPublishedAtLeastOneEnvironment,
61
- defaultContentConfig,
62
- buildConfig
63
- };