@usertour/helpers 0.0.14 → 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.
package/dist/content.cjs CHANGED
@@ -20,10 +20,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/content.ts
21
21
  var content_exports = {};
22
22
  __export(content_exports, {
23
+ autoStartConditions: () => autoStartConditions,
24
+ buildConfig: () => buildConfig,
25
+ defaultContentConfig: () => defaultContentConfig,
23
26
  isPublishedAtLeastOneEnvironment: () => isPublishedAtLeastOneEnvironment,
24
27
  isPublishedInAllEnvironments: () => isPublishedInAllEnvironments
25
28
  });
26
29
  module.exports = __toCommonJS(content_exports);
30
+ var import_types = require("@usertour/types");
31
+ var import_deepmerge_ts = require("deepmerge-ts");
27
32
  var isPublishedInAllEnvironments = (content, environmentList, version) => {
28
33
  const isPublishedInAllEnvironments2 = environmentList == null ? void 0 : environmentList.every(
29
34
  (env) => {
@@ -46,8 +51,52 @@ var isPublishedAtLeastOneEnvironment = (content) => {
46
51
  }
47
52
  return false;
48
53
  };
54
+ var rulesSetting = {
55
+ // frequency: {
56
+ // frequency: Frequency.ONCE,
57
+ // every: { duration: 0, times: 1, unit: FrequencyUnits.MINUTES },
58
+ // atLeast: { duration: 0, unit: FrequencyUnits.MINUTES },
59
+ // },
60
+ startIfNotComplete: false,
61
+ priority: import_types.ContentPriority.MEDIUM,
62
+ wait: 0
63
+ };
64
+ var hideRulesSetting = {};
65
+ var defaultContentConfig = {
66
+ enabledAutoStartRules: false,
67
+ enabledHideRules: false,
68
+ autoStartRules: [],
69
+ hideRules: [],
70
+ autoStartRulesSetting: rulesSetting,
71
+ hideRulesSetting
72
+ };
73
+ var autoStartConditions = {
74
+ ...defaultContentConfig,
75
+ enabledAutoStartRules: true,
76
+ autoStartRules: [
77
+ {
78
+ data: { excludes: [], includes: ["/*"] },
79
+ type: "current-page",
80
+ operators: "and"
81
+ }
82
+ ]
83
+ };
84
+ var buildConfig = (config) => {
85
+ return {
86
+ ...defaultContentConfig,
87
+ ...config,
88
+ autoStartRulesSetting: (0, import_deepmerge_ts.deepmerge)(
89
+ defaultContentConfig.autoStartRulesSetting,
90
+ (config == null ? void 0 : config.autoStartRulesSetting) || {}
91
+ ),
92
+ hideRulesSetting: (config == null ? void 0 : config.hideRulesSetting) || {}
93
+ };
94
+ };
49
95
  // Annotate the CommonJS export names for ESM import in node:
50
96
  0 && (module.exports = {
97
+ autoStartConditions,
98
+ buildConfig,
99
+ defaultContentConfig,
51
100
  isPublishedAtLeastOneEnvironment,
52
101
  isPublishedInAllEnvironments
53
102
  });
@@ -1,6 +1,9 @@
1
- import { Content, Environment, ContentVersion } from '@usertour/types';
1
+ import { Content, Environment, ContentVersion, ContentConfigObject } from '@usertour/types';
2
2
 
3
3
  declare const isPublishedInAllEnvironments: (content: Content | null, environmentList: Environment[] | null, version: ContentVersion | null) => boolean;
4
4
  declare const isPublishedAtLeastOneEnvironment: (content: Content | null) => boolean;
5
+ declare const defaultContentConfig: ContentConfigObject;
6
+ declare const autoStartConditions: ContentConfigObject;
7
+ declare const buildConfig: (config: ContentConfigObject | undefined) => ContentConfigObject;
5
8
 
6
- export { isPublishedAtLeastOneEnvironment, isPublishedInAllEnvironments };
9
+ export { autoStartConditions, buildConfig, defaultContentConfig, isPublishedAtLeastOneEnvironment, isPublishedInAllEnvironments };
package/dist/content.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import { Content, Environment, ContentVersion } from '@usertour/types';
1
+ import { Content, Environment, ContentVersion, ContentConfigObject } from '@usertour/types';
2
2
 
3
3
  declare const isPublishedInAllEnvironments: (content: Content | null, environmentList: Environment[] | null, version: ContentVersion | null) => boolean;
4
4
  declare const isPublishedAtLeastOneEnvironment: (content: Content | null) => boolean;
5
+ declare const defaultContentConfig: ContentConfigObject;
6
+ declare const autoStartConditions: ContentConfigObject;
7
+ declare const buildConfig: (config: ContentConfigObject | undefined) => ContentConfigObject;
5
8
 
6
- export { isPublishedAtLeastOneEnvironment, isPublishedInAllEnvironments };
9
+ export { autoStartConditions, buildConfig, defaultContentConfig, isPublishedAtLeastOneEnvironment, isPublishedInAllEnvironments };
package/dist/content.js CHANGED
@@ -1,9 +1,15 @@
1
1
  import {
2
+ autoStartConditions,
3
+ buildConfig,
4
+ defaultContentConfig,
2
5
  isPublishedAtLeastOneEnvironment,
3
6
  isPublishedInAllEnvironments
4
- } from "./chunk-BBPZYUJR.js";
7
+ } from "./chunk-B4DTY6GN.js";
5
8
  import "./chunk-XEO3YXBM.js";
6
9
  export {
10
+ autoStartConditions,
11
+ buildConfig,
12
+ defaultContentConfig,
7
13
  isPublishedAtLeastOneEnvironment,
8
14
  isPublishedInAllEnvironments
9
15
  };