@usertour/helpers 0.0.47 → 0.0.49

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,41 @@
1
- import "./chunk-7ODE2AIC.js";
2
1
  import {
3
- regenerateConditionIds
4
- } from "./chunk-SIG4WTEF.js";
2
+ duplicateChecklistData,
3
+ duplicateConfig,
4
+ duplicateData,
5
+ duplicateLauncherData,
6
+ duplicateStep,
7
+ duplicateStepWithRename,
8
+ duplicateSteps,
9
+ duplicateTarget,
10
+ duplicateTriggers,
11
+ extractQuestionData,
12
+ generateUniqueCopyName,
13
+ hasMissingRequiredData,
14
+ isClickableElement,
15
+ isMissingRequiredData,
16
+ isQuestionElement,
17
+ isRestrictedType,
18
+ processQuestionElements
19
+ } from "./chunk-BCAOJ3IY.js";
20
+ import "./chunk-7ODE2AIC.js";
21
+ import "./chunk-SIG4WTEF.js";
5
22
  import "./chunk-YYIGUZNZ.js";
6
23
  import "./chunk-PAESAL23.js";
7
- import {
8
- cuid
9
- } from "./chunk-3KG2HTZ3.js";
24
+ import "./chunk-3KG2HTZ3.js";
10
25
  import "./chunk-KYDXF7SU.js";
11
26
  import "./chunk-JQWKLXW6.js";
12
- import {
13
- isArray,
14
- isEmptyString
15
- } from "./chunk-GFH3VWOC.js";
27
+ import "./chunk-GFH3VWOC.js";
16
28
  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
29
  export {
174
- createStepCopy,
30
+ duplicateChecklistData,
31
+ duplicateConfig,
32
+ duplicateData,
33
+ duplicateLauncherData,
34
+ duplicateStep,
35
+ duplicateStepWithRename,
36
+ duplicateSteps,
37
+ duplicateTarget,
38
+ duplicateTriggers,
175
39
  extractQuestionData,
176
40
  generateUniqueCopyName,
177
41
  hasMissingRequiredData,
@@ -179,7 +43,5 @@ export {
179
43
  isMissingRequiredData,
180
44
  isQuestionElement,
181
45
  isRestrictedType,
182
- processQuestionElements,
183
- regenerateTarget,
184
- regenerateTrigger
46
+ processQuestionElements
185
47
  };
package/dist/index.cjs CHANGED
@@ -54,6 +54,15 @@ __export(src_exports, {
54
54
  defaultContentConfig: () => defaultContentConfig,
55
55
  defaultStep: () => defaultStep,
56
56
  document: () => document,
57
+ duplicateChecklistData: () => duplicateChecklistData,
58
+ duplicateConfig: () => duplicateConfig,
59
+ duplicateData: () => duplicateData,
60
+ duplicateLauncherData: () => duplicateLauncherData,
61
+ duplicateStep: () => duplicateStep,
62
+ duplicateStepWithRename: () => duplicateStepWithRename,
63
+ duplicateSteps: () => duplicateSteps,
64
+ duplicateTarget: () => duplicateTarget,
65
+ duplicateTriggers: () => duplicateTriggers,
57
66
  evalCode: () => evalCode,
58
67
  evaluateAttributeCondition: () => evaluateAttributeCondition,
59
68
  evaluateRule: () => evaluateRule,
@@ -61,11 +70,13 @@ __export(src_exports, {
61
70
  evaluateTimeCondition: () => evaluateTimeCondition,
62
71
  evaluateUrlCondition: () => evaluateUrlCondition,
63
72
  extractLinkUrl: () => extractLinkUrl,
73
+ extractQuestionData: () => extractQuestionData,
64
74
  fetch: () => fetch,
65
75
  filterConditionsByType: () => filterConditionsByType,
66
76
  filterNullAttributes: () => filterNullAttributes,
67
77
  formatDate: () => formatDate,
68
78
  generateAutoStateColors: () => generateAutoStateColors,
79
+ generateUniqueCopyName: () => generateUniqueCopyName,
69
80
  getAttributeType: () => getAttributeType,
70
81
  getAuthToken: () => getAuthToken,
71
82
  getCodeError: () => getCodeError,
@@ -84,11 +95,13 @@ __export(src_exports, {
84
95
  getWaitError: () => getWaitError,
85
96
  hasActionError: () => hasActionError,
86
97
  hasError: () => hasError,
98
+ hasMissingRequiredData: () => hasMissingRequiredData,
87
99
  hexToHSLString: () => hexToHSLString,
88
100
  hexToRGBStr: () => hexToRGBStr,
89
101
  hexToRgb: () => hexToRgb,
90
102
  isArray: () => isArray,
91
103
  isBoolean: () => isBoolean,
104
+ isClickableElement: () => isClickableElement,
92
105
  isConditionsActived: () => isConditionsActived,
93
106
  isDark: () => isDark,
94
107
  isDate: () => isDate,
@@ -100,12 +113,15 @@ __export(src_exports, {
100
113
  isFormData: () => isFormData,
101
114
  isFunction: () => isFunction,
102
115
  isMatchUrlPattern: () => isMatchUrlPattern,
116
+ isMissingRequiredData: () => isMissingRequiredData,
103
117
  isNull: () => isNull,
104
118
  isNullish: () => isNullish,
105
119
  isNumber: () => isNumber,
106
120
  isObject: () => isObject,
107
121
  isPublishedAtLeastOneEnvironment: () => isPublishedAtLeastOneEnvironment,
108
122
  isPublishedInAllEnvironments: () => isPublishedInAllEnvironments,
123
+ isQuestionElement: () => isQuestionElement,
124
+ isRestrictedType: () => isRestrictedType,
109
125
  isString: () => isString,
110
126
  isTimeConditionDataLegacy: () => isTimeConditionDataLegacy,
111
127
  isTimeConditionDataV2: () => isTimeConditionDataV2,
@@ -121,6 +137,7 @@ __export(src_exports, {
121
137
  navigator: () => navigator,
122
138
  normalizeTimeConditionData: () => normalizeTimeConditionData,
123
139
  parseUrlParams: () => parseUrlParams,
140
+ processQuestionElements: () => processQuestionElements,
124
141
  regenerateConditionIds: () => regenerateConditionIds,
125
142
  removeAuthToken: () => removeAuthToken,
126
143
  replaceUserAttr: () => replaceUserAttr,
@@ -1690,6 +1707,224 @@ var filterNullAttributes = (attributes) => {
1690
1707
  }
1691
1708
  return attrs;
1692
1709
  };
1710
+
1711
+ // src/content-helper.ts
1712
+ var import_types7 = require("@usertour/types");
1713
+ var isRestrictedType = (type) => {
1714
+ const restrictedTypes = [
1715
+ import_types7.ContentEditorElementType.NPS,
1716
+ import_types7.ContentEditorElementType.STAR_RATING,
1717
+ import_types7.ContentEditorElementType.SCALE,
1718
+ import_types7.ContentEditorElementType.SINGLE_LINE_TEXT,
1719
+ import_types7.ContentEditorElementType.MULTI_LINE_TEXT,
1720
+ import_types7.ContentEditorElementType.MULTIPLE_CHOICE
1721
+ ];
1722
+ return restrictedTypes.includes(type);
1723
+ };
1724
+ var isMissingRequiredData = (element) => {
1725
+ var _a, _b, _c, _d;
1726
+ if (isRestrictedType(element.type)) {
1727
+ return isEmptyString((_a = element.data) == null ? void 0 : _a.name);
1728
+ }
1729
+ if (element.type === import_types7.ContentEditorElementType.BUTTON) {
1730
+ if (isEmptyString((_b = element.data) == null ? void 0 : _b.text)) {
1731
+ return true;
1732
+ }
1733
+ 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) {
1734
+ return true;
1735
+ }
1736
+ }
1737
+ return false;
1738
+ };
1739
+ var hasMissingRequiredData = (contents) => {
1740
+ return contents.some(
1741
+ (group) => group.children.some(
1742
+ (column) => column.children.some((item) => isMissingRequiredData(item.element))
1743
+ )
1744
+ );
1745
+ };
1746
+ var isQuestionElement = (element) => {
1747
+ 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;
1748
+ };
1749
+ var isClickableElement = (element) => {
1750
+ return element.type === import_types7.ContentEditorElementType.BUTTON || isQuestionElement(element);
1751
+ };
1752
+ var extractQuestionData = (data) => {
1753
+ const result = [];
1754
+ function isQuestionRootElement(item) {
1755
+ return "element" in item && isQuestionElement(item.element);
1756
+ }
1757
+ function traverse(item) {
1758
+ if (isQuestionRootElement(item)) {
1759
+ result.push(item.element);
1760
+ }
1761
+ if ("children" in item && item.children) {
1762
+ for (const child of item.children) {
1763
+ traverse(child);
1764
+ }
1765
+ }
1766
+ }
1767
+ for (const item of data) {
1768
+ traverse(item);
1769
+ }
1770
+ return result;
1771
+ };
1772
+ var processQuestionElements = (contents) => {
1773
+ if (!contents || !isArray(contents) || contents.length === 0) {
1774
+ return [];
1775
+ }
1776
+ return contents.map((group) => ({
1777
+ ...group,
1778
+ children: group.children.map((column) => ({
1779
+ ...column,
1780
+ children: column.children.map((item) => {
1781
+ var _a, _b;
1782
+ const element = item.element;
1783
+ if (isQuestionElement(element)) {
1784
+ const questionElement = element;
1785
+ const updatedElement = {
1786
+ ...questionElement,
1787
+ data: {
1788
+ ...questionElement.data,
1789
+ cvid: cuid(),
1790
+ ...((_a = questionElement.data) == null ? void 0 : _a.actions) && isArray(questionElement.data.actions) ? { actions: regenerateConditionIds(questionElement.data.actions) } : {}
1791
+ }
1792
+ };
1793
+ return {
1794
+ ...item,
1795
+ element: updatedElement
1796
+ };
1797
+ }
1798
+ if (element.type === import_types7.ContentEditorElementType.BUTTON) {
1799
+ const buttonElement = element;
1800
+ if (((_b = buttonElement.data) == null ? void 0 : _b.actions) && isArray(buttonElement.data.actions)) {
1801
+ return {
1802
+ ...item,
1803
+ element: {
1804
+ ...buttonElement,
1805
+ data: {
1806
+ ...buttonElement.data,
1807
+ actions: regenerateConditionIds(buttonElement.data.actions)
1808
+ }
1809
+ }
1810
+ };
1811
+ }
1812
+ }
1813
+ return item;
1814
+ })
1815
+ }))
1816
+ }));
1817
+ };
1818
+ var generateUniqueCopyName = (originalName, existingNames) => {
1819
+ let name = `${originalName} (copy)`;
1820
+ if (existingNames == null ? void 0 : existingNames.includes(name)) {
1821
+ let number = 2;
1822
+ while (existingNames.includes(`${originalName} (copy ${number})`)) {
1823
+ number++;
1824
+ }
1825
+ name = `${originalName} (copy ${number})`;
1826
+ }
1827
+ return name;
1828
+ };
1829
+ var duplicateTriggers = (triggers) => {
1830
+ if (!isArray(triggers)) {
1831
+ return triggers;
1832
+ }
1833
+ return triggers.map((trigger) => ({
1834
+ ...trigger,
1835
+ id: cuid(),
1836
+ actions: isArray(trigger.actions) ? regenerateConditionIds(trigger.actions) : trigger.actions,
1837
+ conditions: isArray(trigger.conditions) ? regenerateConditionIds(trigger.conditions) : trigger.conditions
1838
+ }));
1839
+ };
1840
+ var duplicateTarget = (target) => {
1841
+ if (!target) {
1842
+ return void 0;
1843
+ }
1844
+ if (target.actions && isArray(target.actions)) {
1845
+ return {
1846
+ ...target,
1847
+ actions: regenerateConditionIds(target.actions)
1848
+ };
1849
+ }
1850
+ return target;
1851
+ };
1852
+ var duplicateChecklistData = (data) => {
1853
+ if (!data || !isObject(data) || !isArray(data.items)) {
1854
+ return data;
1855
+ }
1856
+ const checklistData = data;
1857
+ return {
1858
+ ...checklistData,
1859
+ content: processQuestionElements(checklistData.content),
1860
+ items: checklistData.items.map((item) => ({
1861
+ ...item,
1862
+ id: uuidV4(),
1863
+ clickedActions: isArray(item.clickedActions) ? regenerateConditionIds(item.clickedActions) : item.clickedActions,
1864
+ completeConditions: isArray(item.completeConditions) ? regenerateConditionIds(item.completeConditions) : item.completeConditions,
1865
+ onlyShowTaskConditions: isArray(item.onlyShowTaskConditions) ? regenerateConditionIds(item.onlyShowTaskConditions) : item.onlyShowTaskConditions
1866
+ }))
1867
+ };
1868
+ };
1869
+ var duplicateLauncherData = (data) => {
1870
+ if (!data || !isObject(data)) {
1871
+ return data;
1872
+ }
1873
+ const launcherData = data;
1874
+ return {
1875
+ ...launcherData,
1876
+ behavior: launcherData.behavior ? {
1877
+ ...launcherData.behavior,
1878
+ actions: isArray(launcherData.behavior.actions) ? regenerateConditionIds(launcherData.behavior.actions) : launcherData.behavior.actions
1879
+ } : launcherData.behavior,
1880
+ tooltip: launcherData.tooltip ? {
1881
+ ...launcherData.tooltip,
1882
+ content: processQuestionElements(launcherData.tooltip.content)
1883
+ } : launcherData.tooltip
1884
+ };
1885
+ };
1886
+ var duplicateConfig = (config) => {
1887
+ if (!config) {
1888
+ return config;
1889
+ }
1890
+ return {
1891
+ ...config,
1892
+ autoStartRules: config.autoStartRules ? regenerateConditionIds(config.autoStartRules) : config.autoStartRules,
1893
+ hideRules: config.hideRules ? regenerateConditionIds(config.hideRules) : config.hideRules
1894
+ };
1895
+ };
1896
+ var duplicateData = (data, contentType) => {
1897
+ if (contentType === import_types7.ContentDataType.CHECKLIST) {
1898
+ return duplicateChecklistData(data);
1899
+ }
1900
+ if (contentType === import_types7.ContentDataType.LAUNCHER) {
1901
+ return duplicateLauncherData(data);
1902
+ }
1903
+ return data;
1904
+ };
1905
+ var duplicateStep = (step) => {
1906
+ const { id, cvid, createdAt, updatedAt, versionId, trigger, target, data, ...rest } = step;
1907
+ return {
1908
+ ...rest,
1909
+ data: data ? processQuestionElements(data) : data,
1910
+ trigger: trigger ? duplicateTriggers(trigger) : trigger,
1911
+ target: duplicateTarget(target)
1912
+ };
1913
+ };
1914
+ var duplicateSteps = (steps) => {
1915
+ if (!isArray(steps)) {
1916
+ return [];
1917
+ }
1918
+ return steps.map((step) => duplicateStep(step));
1919
+ };
1920
+ var duplicateStepWithRename = (originalStep, sequence, existingStepNames) => {
1921
+ const duplicated = duplicateStep(originalStep);
1922
+ return {
1923
+ ...duplicated,
1924
+ name: generateUniqueCopyName(originalStep.name, existingStepNames),
1925
+ sequence
1926
+ };
1927
+ };
1693
1928
  // Annotate the CommonJS export names for ESM import in node:
1694
1929
  0 && (module.exports = {
1695
1930
  AbortController,
@@ -1711,6 +1946,15 @@ var filterNullAttributes = (attributes) => {
1711
1946
  defaultContentConfig,
1712
1947
  defaultStep,
1713
1948
  document,
1949
+ duplicateChecklistData,
1950
+ duplicateConfig,
1951
+ duplicateData,
1952
+ duplicateLauncherData,
1953
+ duplicateStep,
1954
+ duplicateStepWithRename,
1955
+ duplicateSteps,
1956
+ duplicateTarget,
1957
+ duplicateTriggers,
1714
1958
  evalCode,
1715
1959
  evaluateAttributeCondition,
1716
1960
  evaluateRule,
@@ -1718,11 +1962,13 @@ var filterNullAttributes = (attributes) => {
1718
1962
  evaluateTimeCondition,
1719
1963
  evaluateUrlCondition,
1720
1964
  extractLinkUrl,
1965
+ extractQuestionData,
1721
1966
  fetch,
1722
1967
  filterConditionsByType,
1723
1968
  filterNullAttributes,
1724
1969
  formatDate,
1725
1970
  generateAutoStateColors,
1971
+ generateUniqueCopyName,
1726
1972
  getAttributeType,
1727
1973
  getAuthToken,
1728
1974
  getCodeError,
@@ -1741,11 +1987,13 @@ var filterNullAttributes = (attributes) => {
1741
1987
  getWaitError,
1742
1988
  hasActionError,
1743
1989
  hasError,
1990
+ hasMissingRequiredData,
1744
1991
  hexToHSLString,
1745
1992
  hexToRGBStr,
1746
1993
  hexToRgb,
1747
1994
  isArray,
1748
1995
  isBoolean,
1996
+ isClickableElement,
1749
1997
  isConditionsActived,
1750
1998
  isDark,
1751
1999
  isDate,
@@ -1757,12 +2005,15 @@ var filterNullAttributes = (attributes) => {
1757
2005
  isFormData,
1758
2006
  isFunction,
1759
2007
  isMatchUrlPattern,
2008
+ isMissingRequiredData,
1760
2009
  isNull,
1761
2010
  isNullish,
1762
2011
  isNumber,
1763
2012
  isObject,
1764
2013
  isPublishedAtLeastOneEnvironment,
1765
2014
  isPublishedInAllEnvironments,
2015
+ isQuestionElement,
2016
+ isRestrictedType,
1766
2017
  isString,
1767
2018
  isTimeConditionDataLegacy,
1768
2019
  isTimeConditionDataV2,
@@ -1778,6 +2029,7 @@ var filterNullAttributes = (attributes) => {
1778
2029
  navigator,
1779
2030
  normalizeTimeConditionData,
1780
2031
  parseUrlParams,
2032
+ processQuestionElements,
1781
2033
  regenerateConditionIds,
1782
2034
  removeAuthToken,
1783
2035
  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 { duplicateChecklistData, duplicateConfig, duplicateData, duplicateLauncherData, duplicateStep, duplicateStepWithRename, duplicateSteps, 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 { duplicateChecklistData, duplicateConfig, duplicateData, duplicateLauncherData, duplicateStep, duplicateStepWithRename, duplicateSteps, 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,25 @@ import {
22
22
  storage
23
23
  } from "./chunk-FGFMTWFT.js";
24
24
  import "./chunk-3ZGH3NRU.js";
25
+ import {
26
+ duplicateChecklistData,
27
+ duplicateConfig,
28
+ duplicateData,
29
+ duplicateLauncherData,
30
+ duplicateStep,
31
+ duplicateStepWithRename,
32
+ duplicateSteps,
33
+ duplicateTarget,
34
+ duplicateTriggers,
35
+ extractQuestionData,
36
+ generateUniqueCopyName,
37
+ hasMissingRequiredData,
38
+ isClickableElement,
39
+ isMissingRequiredData,
40
+ isQuestionElement,
41
+ isRestrictedType,
42
+ processQuestionElements
43
+ } from "./chunk-BCAOJ3IY.js";
25
44
  import "./chunk-7ODE2AIC.js";
26
45
  import {
27
46
  allConditionsHaveIds,
@@ -149,6 +168,15 @@ export {
149
168
  defaultContentConfig,
150
169
  defaultStep,
151
170
  document,
171
+ duplicateChecklistData,
172
+ duplicateConfig,
173
+ duplicateData,
174
+ duplicateLauncherData,
175
+ duplicateStep,
176
+ duplicateStepWithRename,
177
+ duplicateSteps,
178
+ duplicateTarget,
179
+ duplicateTriggers,
152
180
  evalCode,
153
181
  evaluateAttributeCondition,
154
182
  evaluateRule,
@@ -156,11 +184,13 @@ export {
156
184
  evaluateTimeCondition,
157
185
  evaluateUrlCondition,
158
186
  extractLinkUrl,
187
+ extractQuestionData,
159
188
  fetch,
160
189
  filterConditionsByType,
161
190
  filterNullAttributes,
162
191
  formatDate,
163
192
  generateAutoStateColors,
193
+ generateUniqueCopyName,
164
194
  getAttributeType,
165
195
  getAuthToken,
166
196
  getCodeError,
@@ -179,11 +209,13 @@ export {
179
209
  getWaitError,
180
210
  hasActionError,
181
211
  hasError,
212
+ hasMissingRequiredData,
182
213
  hexToHSLString,
183
214
  hexToRGBStr,
184
215
  hexToRgb,
185
216
  isArray,
186
217
  isBoolean,
218
+ isClickableElement,
187
219
  isConditionsActived,
188
220
  isDark,
189
221
  isDate,
@@ -195,12 +227,15 @@ export {
195
227
  isFormData,
196
228
  isFunction,
197
229
  isMatchUrlPattern,
230
+ isMissingRequiredData,
198
231
  isNull,
199
232
  isNullish,
200
233
  isNumber,
201
234
  isObject,
202
235
  isPublishedAtLeastOneEnvironment,
203
236
  isPublishedInAllEnvironments,
237
+ isQuestionElement,
238
+ isRestrictedType,
204
239
  isString,
205
240
  isTimeConditionDataLegacy,
206
241
  isTimeConditionDataV2,
@@ -216,6 +251,7 @@ export {
216
251
  navigator,
217
252
  normalizeTimeConditionData,
218
253
  parseUrlParams,
254
+ processQuestionElements,
219
255
  regenerateConditionIds,
220
256
  removeAuthToken,
221
257
  replaceUserAttr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usertour/helpers",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "type": "module",
5
5
  "description": "Utility functions and helpers shared across the UserTour project",
6
6
  "homepage": "https://www.usertour.io",