@usertour/helpers 0.0.46 → 0.0.48

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,177 +1,35 @@
1
- import "./chunk-7ODE2AIC.js";
2
1
  import {
3
- regenerateConditionIds
4
- } from "./chunk-SLM6E7HG.js";
2
+ createStepCopy,
3
+ duplicateChecklistData,
4
+ duplicateConfig,
5
+ duplicateData,
6
+ duplicateTarget,
7
+ duplicateTriggers,
8
+ extractQuestionData,
9
+ generateUniqueCopyName,
10
+ hasMissingRequiredData,
11
+ isClickableElement,
12
+ isMissingRequiredData,
13
+ isQuestionElement,
14
+ isRestrictedType,
15
+ processQuestionElements
16
+ } from "./chunk-7GJAPR7Y.js";
17
+ import "./chunk-7ODE2AIC.js";
18
+ import "./chunk-SIG4WTEF.js";
5
19
  import "./chunk-YYIGUZNZ.js";
6
20
  import "./chunk-PAESAL23.js";
7
- import {
8
- cuid
9
- } from "./chunk-3KG2HTZ3.js";
21
+ import "./chunk-3KG2HTZ3.js";
10
22
  import "./chunk-KYDXF7SU.js";
11
23
  import "./chunk-JQWKLXW6.js";
12
- import {
13
- isArray,
14
- isEmptyString
15
- } from "./chunk-GFH3VWOC.js";
24
+ import "./chunk-GFH3VWOC.js";
16
25
  import "./chunk-XEO3YXBM.js";
17
-
18
- // src/content-helper.ts
19
- import {
20
- ContentEditorElementType
21
- } from "@usertour/types";
22
- var isRestrictedType = (type) => {
23
- const restrictedTypes = [
24
- ContentEditorElementType.NPS,
25
- ContentEditorElementType.STAR_RATING,
26
- ContentEditorElementType.SCALE,
27
- ContentEditorElementType.SINGLE_LINE_TEXT,
28
- ContentEditorElementType.MULTI_LINE_TEXT,
29
- ContentEditorElementType.MULTIPLE_CHOICE
30
- ];
31
- return restrictedTypes.includes(type);
32
- };
33
- var isMissingRequiredData = (element) => {
34
- var _a, _b, _c, _d;
35
- if (isRestrictedType(element.type)) {
36
- return isEmptyString((_a = element.data) == null ? void 0 : _a.name);
37
- }
38
- if (element.type === ContentEditorElementType.BUTTON) {
39
- if (isEmptyString((_b = element.data) == null ? void 0 : _b.text)) {
40
- return true;
41
- }
42
- if (!((_c = element == null ? void 0 : element.data) == null ? void 0 : _c.actions) || ((_d = element == null ? void 0 : element.data) == null ? void 0 : _d.actions.length) === 0) {
43
- return true;
44
- }
45
- }
46
- return false;
47
- };
48
- var hasMissingRequiredData = (contents) => {
49
- return contents.some(
50
- (group) => group.children.some(
51
- (column) => column.children.some((item) => isMissingRequiredData(item.element))
52
- )
53
- );
54
- };
55
- var isQuestionElement = (element) => {
56
- return element.type === ContentEditorElementType.SINGLE_LINE_TEXT || element.type === ContentEditorElementType.MULTI_LINE_TEXT || element.type === ContentEditorElementType.NPS || element.type === ContentEditorElementType.STAR_RATING || element.type === ContentEditorElementType.SCALE || element.type === ContentEditorElementType.MULTIPLE_CHOICE;
57
- };
58
- var isClickableElement = (element) => {
59
- return element.type === ContentEditorElementType.BUTTON || isQuestionElement(element);
60
- };
61
- var extractQuestionData = (data) => {
62
- const result = [];
63
- function isQuestionRootElement(item) {
64
- return "element" in item && isQuestionElement(item.element);
65
- }
66
- function traverse(item) {
67
- if (isQuestionRootElement(item)) {
68
- result.push(item.element);
69
- }
70
- if ("children" in item && item.children) {
71
- for (const child of item.children) {
72
- traverse(child);
73
- }
74
- }
75
- }
76
- for (const item of data) {
77
- traverse(item);
78
- }
79
- return result;
80
- };
81
- var processQuestionElements = (contents) => {
82
- if (!contents || !isArray(contents) || contents.length === 0) {
83
- return [];
84
- }
85
- return contents.map((group) => ({
86
- ...group,
87
- children: group.children.map((column) => ({
88
- ...column,
89
- children: column.children.map((item) => {
90
- var _a, _b;
91
- const element = item.element;
92
- if (isQuestionElement(element)) {
93
- const questionElement = element;
94
- const updatedElement = {
95
- ...questionElement,
96
- data: {
97
- ...questionElement.data,
98
- cvid: cuid(),
99
- ...((_a = questionElement.data) == null ? void 0 : _a.actions) && isArray(questionElement.data.actions) ? { actions: regenerateConditionIds(questionElement.data.actions) } : {}
100
- }
101
- };
102
- return {
103
- ...item,
104
- element: updatedElement
105
- };
106
- }
107
- if (element.type === ContentEditorElementType.BUTTON) {
108
- const buttonElement = element;
109
- if (((_b = buttonElement.data) == null ? void 0 : _b.actions) && isArray(buttonElement.data.actions)) {
110
- return {
111
- ...item,
112
- element: {
113
- ...buttonElement,
114
- data: {
115
- ...buttonElement.data,
116
- actions: regenerateConditionIds(buttonElement.data.actions)
117
- }
118
- }
119
- };
120
- }
121
- }
122
- return item;
123
- })
124
- }))
125
- }));
126
- };
127
- var regenerateTrigger = (trigger) => {
128
- return trigger.map((t) => ({
129
- ...t,
130
- id: cuid(),
131
- conditions: regenerateConditionIds(t.conditions),
132
- actions: regenerateConditionIds(t.actions)
133
- }));
134
- };
135
- var regenerateTarget = (target) => {
136
- if (!target) {
137
- return void 0;
138
- }
139
- if (target.actions && isArray(target.actions)) {
140
- return {
141
- ...target,
142
- actions: regenerateConditionIds(target.actions)
143
- };
144
- }
145
- return target;
146
- };
147
- var generateUniqueCopyName = (originalName, existingNames) => {
148
- let name = `${originalName} (copy)`;
149
- if (existingNames == null ? void 0 : existingNames.includes(name)) {
150
- let number = 2;
151
- while (existingNames.includes(`${originalName} (copy ${number})`)) {
152
- number++;
153
- }
154
- name = `${originalName} (copy ${number})`;
155
- }
156
- return name;
157
- };
158
- var createStepCopy = (originalStep, sequence, existingStepNames) => {
159
- const { id, cvid, updatedAt, createdAt, ...rest } = originalStep;
160
- const name = generateUniqueCopyName(originalStep == null ? void 0 : originalStep.name, existingStepNames);
161
- const trigger = (originalStep == null ? void 0 : originalStep.trigger) ? regenerateTrigger(originalStep == null ? void 0 : originalStep.trigger) : [];
162
- const data = (originalStep == null ? void 0 : originalStep.data) ? processQuestionElements(originalStep == null ? void 0 : originalStep.data) : [];
163
- const target = regenerateTarget(originalStep == null ? void 0 : originalStep.target);
164
- return {
165
- ...rest,
166
- data,
167
- trigger,
168
- target,
169
- name,
170
- sequence
171
- };
172
- };
173
26
  export {
174
27
  createStepCopy,
28
+ duplicateChecklistData,
29
+ duplicateConfig,
30
+ duplicateData,
31
+ duplicateTarget,
32
+ duplicateTriggers,
175
33
  extractQuestionData,
176
34
  generateUniqueCopyName,
177
35
  hasMissingRequiredData,
@@ -179,7 +37,5 @@ export {
179
37
  isMissingRequiredData,
180
38
  isQuestionElement,
181
39
  isRestrictedType,
182
- processQuestionElements,
183
- regenerateTarget,
184
- regenerateTrigger
40
+ processQuestionElements
185
41
  };
package/dist/index.cjs CHANGED
@@ -49,11 +49,17 @@ __export(src_exports, {
49
49
  convertSettings: () => convertSettings,
50
50
  convertTimeConditionLegacyToV2: () => convertTimeConditionLegacyToV2,
51
51
  convertToCssVars: () => convertToCssVars,
52
+ createStepCopy: () => createStepCopy,
52
53
  cuid: () => cuid,
53
54
  deepClone: () => deepClone,
54
55
  defaultContentConfig: () => defaultContentConfig,
55
56
  defaultStep: () => defaultStep,
56
57
  document: () => document,
58
+ duplicateChecklistData: () => duplicateChecklistData,
59
+ duplicateConfig: () => duplicateConfig,
60
+ duplicateData: () => duplicateData,
61
+ duplicateTarget: () => duplicateTarget,
62
+ duplicateTriggers: () => duplicateTriggers,
57
63
  evalCode: () => evalCode,
58
64
  evaluateAttributeCondition: () => evaluateAttributeCondition,
59
65
  evaluateRule: () => evaluateRule,
@@ -61,11 +67,13 @@ __export(src_exports, {
61
67
  evaluateTimeCondition: () => evaluateTimeCondition,
62
68
  evaluateUrlCondition: () => evaluateUrlCondition,
63
69
  extractLinkUrl: () => extractLinkUrl,
70
+ extractQuestionData: () => extractQuestionData,
64
71
  fetch: () => fetch,
65
72
  filterConditionsByType: () => filterConditionsByType,
66
73
  filterNullAttributes: () => filterNullAttributes,
67
74
  formatDate: () => formatDate,
68
75
  generateAutoStateColors: () => generateAutoStateColors,
76
+ generateUniqueCopyName: () => generateUniqueCopyName,
69
77
  getAttributeType: () => getAttributeType,
70
78
  getAuthToken: () => getAuthToken,
71
79
  getCodeError: () => getCodeError,
@@ -84,11 +92,13 @@ __export(src_exports, {
84
92
  getWaitError: () => getWaitError,
85
93
  hasActionError: () => hasActionError,
86
94
  hasError: () => hasError,
95
+ hasMissingRequiredData: () => hasMissingRequiredData,
87
96
  hexToHSLString: () => hexToHSLString,
88
97
  hexToRGBStr: () => hexToRGBStr,
89
98
  hexToRgb: () => hexToRgb,
90
99
  isArray: () => isArray,
91
100
  isBoolean: () => isBoolean,
101
+ isClickableElement: () => isClickableElement,
92
102
  isConditionsActived: () => isConditionsActived,
93
103
  isDark: () => isDark,
94
104
  isDate: () => isDate,
@@ -100,12 +110,15 @@ __export(src_exports, {
100
110
  isFormData: () => isFormData,
101
111
  isFunction: () => isFunction,
102
112
  isMatchUrlPattern: () => isMatchUrlPattern,
113
+ isMissingRequiredData: () => isMissingRequiredData,
103
114
  isNull: () => isNull,
104
115
  isNullish: () => isNullish,
105
116
  isNumber: () => isNumber,
106
117
  isObject: () => isObject,
107
118
  isPublishedAtLeastOneEnvironment: () => isPublishedAtLeastOneEnvironment,
108
119
  isPublishedInAllEnvironments: () => isPublishedInAllEnvironments,
120
+ isQuestionElement: () => isQuestionElement,
121
+ isRestrictedType: () => isRestrictedType,
109
122
  isString: () => isString,
110
123
  isTimeConditionDataLegacy: () => isTimeConditionDataLegacy,
111
124
  isTimeConditionDataV2: () => isTimeConditionDataV2,
@@ -121,6 +134,7 @@ __export(src_exports, {
121
134
  navigator: () => navigator,
122
135
  normalizeTimeConditionData: () => normalizeTimeConditionData,
123
136
  parseUrlParams: () => parseUrlParams,
137
+ processQuestionElements: () => processQuestionElements,
124
138
  regenerateConditionIds: () => regenerateConditionIds,
125
139
  removeAuthToken: () => removeAuthToken,
126
140
  replaceUserAttr: () => replaceUserAttr,
@@ -1561,9 +1575,9 @@ var evaluateRule = async (condition, options) => {
1561
1575
  var _a, _b;
1562
1576
  const { typeControl = {}, activatedIds, deactivatedIds, customEvaluators } = options;
1563
1577
  const conditionId = condition.id;
1564
- if (activatedIds == null ? void 0 : activatedIds.includes(conditionId))
1578
+ if (conditionId && (activatedIds == null ? void 0 : activatedIds.includes(conditionId)))
1565
1579
  return true;
1566
- if (deactivatedIds == null ? void 0 : deactivatedIds.includes(conditionId))
1580
+ if (conditionId && (deactivatedIds == null ? void 0 : deactivatedIds.includes(conditionId)))
1567
1581
  return false;
1568
1582
  const customEvaluator = customEvaluators == null ? void 0 : customEvaluators[condition.type];
1569
1583
  if (customEvaluator) {
@@ -1690,6 +1704,195 @@ var filterNullAttributes = (attributes) => {
1690
1704
  }
1691
1705
  return attrs;
1692
1706
  };
1707
+
1708
+ // src/content-helper.ts
1709
+ var import_types7 = require("@usertour/types");
1710
+ var isRestrictedType = (type) => {
1711
+ const restrictedTypes = [
1712
+ import_types7.ContentEditorElementType.NPS,
1713
+ import_types7.ContentEditorElementType.STAR_RATING,
1714
+ import_types7.ContentEditorElementType.SCALE,
1715
+ import_types7.ContentEditorElementType.SINGLE_LINE_TEXT,
1716
+ import_types7.ContentEditorElementType.MULTI_LINE_TEXT,
1717
+ import_types7.ContentEditorElementType.MULTIPLE_CHOICE
1718
+ ];
1719
+ return restrictedTypes.includes(type);
1720
+ };
1721
+ var isMissingRequiredData = (element) => {
1722
+ var _a, _b, _c, _d;
1723
+ if (isRestrictedType(element.type)) {
1724
+ return isEmptyString((_a = element.data) == null ? void 0 : _a.name);
1725
+ }
1726
+ if (element.type === import_types7.ContentEditorElementType.BUTTON) {
1727
+ if (isEmptyString((_b = element.data) == null ? void 0 : _b.text)) {
1728
+ return true;
1729
+ }
1730
+ if (!((_c = element == null ? void 0 : element.data) == null ? void 0 : _c.actions) || ((_d = element == null ? void 0 : element.data) == null ? void 0 : _d.actions.length) === 0) {
1731
+ return true;
1732
+ }
1733
+ }
1734
+ return false;
1735
+ };
1736
+ var hasMissingRequiredData = (contents) => {
1737
+ return contents.some(
1738
+ (group) => group.children.some(
1739
+ (column) => column.children.some((item) => isMissingRequiredData(item.element))
1740
+ )
1741
+ );
1742
+ };
1743
+ var isQuestionElement = (element) => {
1744
+ return element.type === import_types7.ContentEditorElementType.SINGLE_LINE_TEXT || element.type === import_types7.ContentEditorElementType.MULTI_LINE_TEXT || element.type === import_types7.ContentEditorElementType.NPS || element.type === import_types7.ContentEditorElementType.STAR_RATING || element.type === import_types7.ContentEditorElementType.SCALE || element.type === import_types7.ContentEditorElementType.MULTIPLE_CHOICE;
1745
+ };
1746
+ var isClickableElement = (element) => {
1747
+ return element.type === import_types7.ContentEditorElementType.BUTTON || isQuestionElement(element);
1748
+ };
1749
+ var extractQuestionData = (data) => {
1750
+ const result = [];
1751
+ function isQuestionRootElement(item) {
1752
+ return "element" in item && isQuestionElement(item.element);
1753
+ }
1754
+ function traverse(item) {
1755
+ if (isQuestionRootElement(item)) {
1756
+ result.push(item.element);
1757
+ }
1758
+ if ("children" in item && item.children) {
1759
+ for (const child of item.children) {
1760
+ traverse(child);
1761
+ }
1762
+ }
1763
+ }
1764
+ for (const item of data) {
1765
+ traverse(item);
1766
+ }
1767
+ return result;
1768
+ };
1769
+ var processQuestionElements = (contents) => {
1770
+ if (!contents || !isArray(contents) || contents.length === 0) {
1771
+ return [];
1772
+ }
1773
+ return contents.map((group) => ({
1774
+ ...group,
1775
+ children: group.children.map((column) => ({
1776
+ ...column,
1777
+ children: column.children.map((item) => {
1778
+ var _a, _b;
1779
+ const element = item.element;
1780
+ if (isQuestionElement(element)) {
1781
+ const questionElement = element;
1782
+ const updatedElement = {
1783
+ ...questionElement,
1784
+ data: {
1785
+ ...questionElement.data,
1786
+ cvid: cuid(),
1787
+ ...((_a = questionElement.data) == null ? void 0 : _a.actions) && isArray(questionElement.data.actions) ? { actions: regenerateConditionIds(questionElement.data.actions) } : {}
1788
+ }
1789
+ };
1790
+ return {
1791
+ ...item,
1792
+ element: updatedElement
1793
+ };
1794
+ }
1795
+ if (element.type === import_types7.ContentEditorElementType.BUTTON) {
1796
+ const buttonElement = element;
1797
+ if (((_b = buttonElement.data) == null ? void 0 : _b.actions) && isArray(buttonElement.data.actions)) {
1798
+ return {
1799
+ ...item,
1800
+ element: {
1801
+ ...buttonElement,
1802
+ data: {
1803
+ ...buttonElement.data,
1804
+ actions: regenerateConditionIds(buttonElement.data.actions)
1805
+ }
1806
+ }
1807
+ };
1808
+ }
1809
+ }
1810
+ return item;
1811
+ })
1812
+ }))
1813
+ }));
1814
+ };
1815
+ var generateUniqueCopyName = (originalName, existingNames) => {
1816
+ let name = `${originalName} (copy)`;
1817
+ if (existingNames == null ? void 0 : existingNames.includes(name)) {
1818
+ let number = 2;
1819
+ while (existingNames.includes(`${originalName} (copy ${number})`)) {
1820
+ number++;
1821
+ }
1822
+ name = `${originalName} (copy ${number})`;
1823
+ }
1824
+ return name;
1825
+ };
1826
+ var duplicateTriggers = (triggers) => {
1827
+ if (!isArray(triggers)) {
1828
+ return triggers;
1829
+ }
1830
+ return triggers.map((trigger) => ({
1831
+ ...trigger,
1832
+ id: cuid(),
1833
+ actions: isArray(trigger.actions) ? regenerateConditionIds(trigger.actions) : trigger.actions,
1834
+ conditions: isArray(trigger.conditions) ? regenerateConditionIds(trigger.conditions) : trigger.conditions
1835
+ }));
1836
+ };
1837
+ var duplicateTarget = (target) => {
1838
+ if (!target) {
1839
+ return void 0;
1840
+ }
1841
+ if (target.actions && isArray(target.actions)) {
1842
+ return {
1843
+ ...target,
1844
+ actions: regenerateConditionIds(target.actions)
1845
+ };
1846
+ }
1847
+ return target;
1848
+ };
1849
+ var duplicateChecklistData = (data) => {
1850
+ if (!data || !isObject(data) || !isArray(data.items)) {
1851
+ return data;
1852
+ }
1853
+ const checklistData = data;
1854
+ return {
1855
+ ...checklistData,
1856
+ items: checklistData.items.map((item) => ({
1857
+ ...item,
1858
+ id: uuidV4(),
1859
+ clickedActions: isArray(item.clickedActions) ? regenerateConditionIds(item.clickedActions) : item.clickedActions,
1860
+ completeConditions: isArray(item.completeConditions) ? regenerateConditionIds(item.completeConditions) : item.completeConditions,
1861
+ onlyShowTaskConditions: isArray(item.onlyShowTaskConditions) ? regenerateConditionIds(item.onlyShowTaskConditions) : item.onlyShowTaskConditions
1862
+ }))
1863
+ };
1864
+ };
1865
+ var duplicateConfig = (config) => {
1866
+ if (!config) {
1867
+ return config;
1868
+ }
1869
+ return {
1870
+ ...config,
1871
+ autoStartRules: config.autoStartRules ? regenerateConditionIds(config.autoStartRules) : config.autoStartRules,
1872
+ hideRules: config.hideRules ? regenerateConditionIds(config.hideRules) : config.hideRules
1873
+ };
1874
+ };
1875
+ var duplicateData = (data, contentType) => {
1876
+ if (contentType === import_types7.ContentDataType.CHECKLIST) {
1877
+ return duplicateChecklistData(data);
1878
+ }
1879
+ return data;
1880
+ };
1881
+ var createStepCopy = (originalStep, sequence, existingStepNames) => {
1882
+ const { id, cvid, updatedAt, createdAt, ...rest } = originalStep;
1883
+ const name = generateUniqueCopyName(originalStep == null ? void 0 : originalStep.name, existingStepNames);
1884
+ const trigger = (originalStep == null ? void 0 : originalStep.trigger) ? duplicateTriggers(originalStep == null ? void 0 : originalStep.trigger) : [];
1885
+ const data = (originalStep == null ? void 0 : originalStep.data) ? processQuestionElements(originalStep == null ? void 0 : originalStep.data) : [];
1886
+ const target = duplicateTarget(originalStep == null ? void 0 : originalStep.target);
1887
+ return {
1888
+ ...rest,
1889
+ data,
1890
+ trigger,
1891
+ target,
1892
+ name,
1893
+ sequence
1894
+ };
1895
+ };
1693
1896
  // Annotate the CommonJS export names for ESM import in node:
1694
1897
  0 && (module.exports = {
1695
1898
  AbortController,
@@ -1706,11 +1909,17 @@ var filterNullAttributes = (attributes) => {
1706
1909
  convertSettings,
1707
1910
  convertTimeConditionLegacyToV2,
1708
1911
  convertToCssVars,
1912
+ createStepCopy,
1709
1913
  cuid,
1710
1914
  deepClone,
1711
1915
  defaultContentConfig,
1712
1916
  defaultStep,
1713
1917
  document,
1918
+ duplicateChecklistData,
1919
+ duplicateConfig,
1920
+ duplicateData,
1921
+ duplicateTarget,
1922
+ duplicateTriggers,
1714
1923
  evalCode,
1715
1924
  evaluateAttributeCondition,
1716
1925
  evaluateRule,
@@ -1718,11 +1927,13 @@ var filterNullAttributes = (attributes) => {
1718
1927
  evaluateTimeCondition,
1719
1928
  evaluateUrlCondition,
1720
1929
  extractLinkUrl,
1930
+ extractQuestionData,
1721
1931
  fetch,
1722
1932
  filterConditionsByType,
1723
1933
  filterNullAttributes,
1724
1934
  formatDate,
1725
1935
  generateAutoStateColors,
1936
+ generateUniqueCopyName,
1726
1937
  getAttributeType,
1727
1938
  getAuthToken,
1728
1939
  getCodeError,
@@ -1741,11 +1952,13 @@ var filterNullAttributes = (attributes) => {
1741
1952
  getWaitError,
1742
1953
  hasActionError,
1743
1954
  hasError,
1955
+ hasMissingRequiredData,
1744
1956
  hexToHSLString,
1745
1957
  hexToRGBStr,
1746
1958
  hexToRgb,
1747
1959
  isArray,
1748
1960
  isBoolean,
1961
+ isClickableElement,
1749
1962
  isConditionsActived,
1750
1963
  isDark,
1751
1964
  isDate,
@@ -1757,12 +1970,15 @@ var filterNullAttributes = (attributes) => {
1757
1970
  isFormData,
1758
1971
  isFunction,
1759
1972
  isMatchUrlPattern,
1973
+ isMissingRequiredData,
1760
1974
  isNull,
1761
1975
  isNullish,
1762
1976
  isNumber,
1763
1977
  isObject,
1764
1978
  isPublishedAtLeastOneEnvironment,
1765
1979
  isPublishedInAllEnvironments,
1980
+ isQuestionElement,
1981
+ isRestrictedType,
1766
1982
  isString,
1767
1983
  isTimeConditionDataLegacy,
1768
1984
  isTimeConditionDataV2,
@@ -1778,6 +1994,7 @@ var filterNullAttributes = (attributes) => {
1778
1994
  navigator,
1779
1995
  normalizeTimeConditionData,
1780
1996
  parseUrlParams,
1997
+ processQuestionElements,
1781
1998
  regenerateConditionIds,
1782
1999
  removeAuthToken,
1783
2000
  replaceUserAttr,
package/dist/index.d.cts CHANGED
@@ -14,6 +14,7 @@ export { evaluateUrlCondition, isMatchUrlPattern } from './conditions/url.cjs';
14
14
  export { convertTimeConditionLegacyToV2, evaluateTimeCondition, isTimeConditionDataLegacy, isTimeConditionDataV2, normalizeTimeConditionData } from './conditions/time.cjs';
15
15
  export { evaluateAttributeCondition } from './conditions/attribute.cjs';
16
16
  export { capitalizeFirstLetter, filterNullAttributes, getAttributeType, isValidISO8601 } from './attribute.cjs';
17
+ export { createStepCopy, duplicateChecklistData, duplicateConfig, duplicateData, duplicateTarget, duplicateTriggers, extractQuestionData, generateUniqueCopyName, hasMissingRequiredData, isClickableElement, isMissingRequiredData, isQuestionElement, isRestrictedType, processQuestionElements } from './content-helper.cjs';
17
18
  export { default as isEqual } from 'fast-deep-equal';
18
19
  import '@usertour/types';
19
20
  import './storage.cjs';
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { evaluateUrlCondition, isMatchUrlPattern } from './conditions/url.js';
14
14
  export { convertTimeConditionLegacyToV2, evaluateTimeCondition, isTimeConditionDataLegacy, isTimeConditionDataV2, normalizeTimeConditionData } from './conditions/time.js';
15
15
  export { evaluateAttributeCondition } from './conditions/attribute.js';
16
16
  export { capitalizeFirstLetter, filterNullAttributes, getAttributeType, isValidISO8601 } from './attribute.js';
17
+ export { createStepCopy, duplicateChecklistData, duplicateConfig, duplicateData, duplicateTarget, duplicateTriggers, extractQuestionData, generateUniqueCopyName, hasMissingRequiredData, isClickableElement, isMissingRequiredData, isQuestionElement, isRestrictedType, processQuestionElements } from './content-helper.js';
17
18
  export { default as isEqual } from 'fast-deep-equal';
18
19
  import '@usertour/types';
19
20
  import './storage.js';
package/dist/index.js CHANGED
@@ -22,6 +22,22 @@ import {
22
22
  storage
23
23
  } from "./chunk-FGFMTWFT.js";
24
24
  import "./chunk-3ZGH3NRU.js";
25
+ import {
26
+ createStepCopy,
27
+ duplicateChecklistData,
28
+ duplicateConfig,
29
+ duplicateData,
30
+ duplicateTarget,
31
+ duplicateTriggers,
32
+ extractQuestionData,
33
+ generateUniqueCopyName,
34
+ hasMissingRequiredData,
35
+ isClickableElement,
36
+ isMissingRequiredData,
37
+ isQuestionElement,
38
+ isRestrictedType,
39
+ processQuestionElements
40
+ } from "./chunk-7GJAPR7Y.js";
25
41
  import "./chunk-7ODE2AIC.js";
26
42
  import {
27
43
  allConditionsHaveIds,
@@ -33,7 +49,7 @@ import {
33
49
  isConditionsActived,
34
50
  isEqual,
35
51
  regenerateConditionIds
36
- } from "./chunk-SLM6E7HG.js";
52
+ } from "./chunk-SIG4WTEF.js";
37
53
  import {
38
54
  evaluateUrlCondition,
39
55
  isMatchUrlPattern
@@ -144,11 +160,17 @@ export {
144
160
  convertSettings,
145
161
  convertTimeConditionLegacyToV2,
146
162
  convertToCssVars,
163
+ createStepCopy,
147
164
  cuid,
148
165
  deepClone,
149
166
  defaultContentConfig,
150
167
  defaultStep,
151
168
  document,
169
+ duplicateChecklistData,
170
+ duplicateConfig,
171
+ duplicateData,
172
+ duplicateTarget,
173
+ duplicateTriggers,
152
174
  evalCode,
153
175
  evaluateAttributeCondition,
154
176
  evaluateRule,
@@ -156,11 +178,13 @@ export {
156
178
  evaluateTimeCondition,
157
179
  evaluateUrlCondition,
158
180
  extractLinkUrl,
181
+ extractQuestionData,
159
182
  fetch,
160
183
  filterConditionsByType,
161
184
  filterNullAttributes,
162
185
  formatDate,
163
186
  generateAutoStateColors,
187
+ generateUniqueCopyName,
164
188
  getAttributeType,
165
189
  getAuthToken,
166
190
  getCodeError,
@@ -179,11 +203,13 @@ export {
179
203
  getWaitError,
180
204
  hasActionError,
181
205
  hasError,
206
+ hasMissingRequiredData,
182
207
  hexToHSLString,
183
208
  hexToRGBStr,
184
209
  hexToRgb,
185
210
  isArray,
186
211
  isBoolean,
212
+ isClickableElement,
187
213
  isConditionsActived,
188
214
  isDark,
189
215
  isDate,
@@ -195,12 +221,15 @@ export {
195
221
  isFormData,
196
222
  isFunction,
197
223
  isMatchUrlPattern,
224
+ isMissingRequiredData,
198
225
  isNull,
199
226
  isNullish,
200
227
  isNumber,
201
228
  isObject,
202
229
  isPublishedAtLeastOneEnvironment,
203
230
  isPublishedInAllEnvironments,
231
+ isQuestionElement,
232
+ isRestrictedType,
204
233
  isString,
205
234
  isTimeConditionDataLegacy,
206
235
  isTimeConditionDataV2,
@@ -216,6 +245,7 @@ export {
216
245
  navigator,
217
246
  normalizeTimeConditionData,
218
247
  parseUrlParams,
248
+ processQuestionElements,
219
249
  regenerateConditionIds,
220
250
  removeAuthToken,
221
251
  replaceUserAttr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usertour/helpers",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "type": "module",
5
5
  "description": "Utility functions and helpers shared across the UserTour project",
6
6
  "homepage": "https://www.usertour.io",