@usertour/helpers 0.0.1
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/README.md +68 -0
- package/dist/auth.cjs +161 -0
- package/dist/auth.d.cts +8 -0
- package/dist/auth.d.ts +8 -0
- package/dist/auth.js +15 -0
- package/dist/chunk-2AEGAICC.js +13 -0
- package/dist/chunk-3KG2HTZ3.js +79 -0
- package/dist/chunk-3ZGH3NRU.js +103 -0
- package/dist/chunk-64BFWPHJ.js +50 -0
- package/dist/chunk-BBPZYUJR.js +28 -0
- package/dist/chunk-FGFMTWFT.js +23 -0
- package/dist/chunk-FNQIIEWK.js +121 -0
- package/dist/chunk-FW54TSA3.js +41 -0
- package/dist/chunk-G5P7KULU.js +223 -0
- package/dist/chunk-GFH3VWOC.js +70 -0
- package/dist/chunk-H7VA3ML2.js +29 -0
- package/dist/chunk-USHOKNHQ.js +243 -0
- package/dist/chunk-VT24VOAZ.js +48 -0
- package/dist/chunk-XEO3YXBM.js +10 -0
- package/dist/chunk-ZNFXGN3M.js +25 -0
- package/dist/color.cjs +84 -0
- package/dist/color.d.cts +29 -0
- package/dist/color.d.ts +29 -0
- package/dist/color.js +11 -0
- package/dist/condition.cjs +157 -0
- package/dist/condition.d.cts +7 -0
- package/dist/condition.d.ts +7 -0
- package/dist/condition.js +11 -0
- package/dist/content-settings.cjs +76 -0
- package/dist/content-settings.d.cts +7 -0
- package/dist/content-settings.d.ts +7 -0
- package/dist/content-settings.js +11 -0
- package/dist/content.cjs +53 -0
- package/dist/content.d.cts +6 -0
- package/dist/content.d.ts +6 -0
- package/dist/content.js +9 -0
- package/dist/convert-settings.cjs +308 -0
- package/dist/convert-settings.d.cts +7 -0
- package/dist/convert-settings.d.ts +7 -0
- package/dist/convert-settings.js +13 -0
- package/dist/error.cjs +259 -0
- package/dist/error.d.cts +56 -0
- package/dist/error.d.ts +56 -0
- package/dist/error.js +37 -0
- package/dist/globals.cjs +64 -0
- package/dist/globals.d.cts +27 -0
- package/dist/globals.d.ts +27 -0
- package/dist/globals.js +29 -0
- package/dist/helper.cjs +111 -0
- package/dist/helper.d.cts +17 -0
- package/dist/helper.d.ts +17 -0
- package/dist/helper.js +23 -0
- package/dist/index.cjs +1165 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +178 -0
- package/dist/is-url.cjs +49 -0
- package/dist/is-url.d.cts +14 -0
- package/dist/is-url.d.ts +14 -0
- package/dist/is-url.js +7 -0
- package/dist/settings.cjs +65 -0
- package/dist/settings.d.cts +5 -0
- package/dist/settings.d.ts +5 -0
- package/dist/settings.js +7 -0
- package/dist/storage.cjs +142 -0
- package/dist/storage.d.cts +25 -0
- package/dist/storage.d.ts +25 -0
- package/dist/storage.js +8 -0
- package/dist/type-utils.cjs +109 -0
- package/dist/type-utils.d.cts +18 -0
- package/dist/type-utils.d.ts +18 -0
- package/dist/type-utils.js +37 -0
- package/dist/utils.cjs +37 -0
- package/dist/utils.d.cts +8 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.js +7 -0
- package/dist/vite-env.d.cjs +1 -0
- package/dist/vite-env.d.d.cts +1 -0
- package/dist/vite-env.d.d.ts +1 -0
- package/dist/vite-env.d.js +0 -0
- package/package.json +56 -0
|
@@ -0,0 +1,308 @@
|
|
|
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/convert-settings.ts
|
|
31
|
+
var convert_settings_exports = {};
|
|
32
|
+
__export(convert_settings_exports, {
|
|
33
|
+
convertSettings: () => convertSettings,
|
|
34
|
+
convertToCssVars: () => convertToCssVars,
|
|
35
|
+
mergeThemeDefaultSettings: () => mergeThemeDefaultSettings
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(convert_settings_exports);
|
|
38
|
+
var import_types = require("@usertour/types");
|
|
39
|
+
|
|
40
|
+
// src/color.ts
|
|
41
|
+
var import_chroma_js = __toESM(require("chroma-js"), 1);
|
|
42
|
+
function hexToHSLString(hexColor) {
|
|
43
|
+
try {
|
|
44
|
+
const color = (0, import_chroma_js.default)(hexColor);
|
|
45
|
+
const [h, s, l] = color.hsl();
|
|
46
|
+
const hDeg = Math.round(h || 0);
|
|
47
|
+
const sPct = Math.round(s * 100);
|
|
48
|
+
const lPct = Math.round(l * 100);
|
|
49
|
+
return `${hDeg} ${sPct}% ${lPct}%`;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
console.warn(`Failed to convert ${hexColor} to HSL string:`, error);
|
|
52
|
+
return "0 0% 0%";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var hexToRGBStr = (hex) => {
|
|
56
|
+
try {
|
|
57
|
+
const color = (0, import_chroma_js.default)(hex);
|
|
58
|
+
const [r, g, b] = color.rgb();
|
|
59
|
+
return `${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)}`;
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.warn(`Failed to convert ${hex} to RGB string:`, error);
|
|
62
|
+
return "0, 0, 0";
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/convert-settings.ts
|
|
67
|
+
var import_deepmerge_ts = require("deepmerge-ts");
|
|
68
|
+
|
|
69
|
+
// src/type-utils.ts
|
|
70
|
+
var nativeIsArray = Array.isArray;
|
|
71
|
+
var ObjProto = Object.prototype;
|
|
72
|
+
var objToString = ObjProto.toString;
|
|
73
|
+
var objHasOwn = ObjProto.hasOwnProperty;
|
|
74
|
+
var isUndefined = (x) => x === void 0;
|
|
75
|
+
|
|
76
|
+
// src/convert-settings.ts
|
|
77
|
+
var defaultFontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
|
|
78
|
+
var mergeThemeDefaultSettings = (settings) => {
|
|
79
|
+
return (0, import_deepmerge_ts.deepmerge)(import_types.defaultSettings, settings);
|
|
80
|
+
};
|
|
81
|
+
var convertSettings = (settings) => {
|
|
82
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
|
|
83
|
+
const data = mergeThemeDefaultSettings(settings);
|
|
84
|
+
if (settings.mainColor.hover === "Auto") {
|
|
85
|
+
data.mainColor.hover = settings.mainColor.autoHover;
|
|
86
|
+
}
|
|
87
|
+
if (settings.mainColor.active === "Auto") {
|
|
88
|
+
data.mainColor.active = settings.mainColor.autoActive;
|
|
89
|
+
}
|
|
90
|
+
if (settings.brandColor.hover === "Auto") {
|
|
91
|
+
data.brandColor.hover = settings.brandColor.autoHover;
|
|
92
|
+
}
|
|
93
|
+
if (settings.brandColor.active === "Auto") {
|
|
94
|
+
data.brandColor.active = settings.brandColor.autoActive;
|
|
95
|
+
}
|
|
96
|
+
if (settings.border.borderColor === "Auto") {
|
|
97
|
+
data.border.borderColor = settings.mainColor.color;
|
|
98
|
+
}
|
|
99
|
+
if (settings.buttons.primary.textColor.color === "Auto") {
|
|
100
|
+
data.buttons.primary.textColor.color = settings.brandColor.color;
|
|
101
|
+
}
|
|
102
|
+
if (settings.buttons.primary.textColor.hover === "Auto") {
|
|
103
|
+
data.buttons.primary.textColor.hover = settings.brandColor.color;
|
|
104
|
+
}
|
|
105
|
+
if (settings.buttons.primary.textColor.active === "Auto") {
|
|
106
|
+
data.buttons.primary.textColor.active = settings.brandColor.color;
|
|
107
|
+
}
|
|
108
|
+
if (settings.buttons.primary.backgroundColor.background === "Auto") {
|
|
109
|
+
data.buttons.primary.backgroundColor.background = settings.brandColor.background;
|
|
110
|
+
}
|
|
111
|
+
if (settings.buttons.primary.backgroundColor.hover === "Auto") {
|
|
112
|
+
data.buttons.primary.backgroundColor.hover = settings.brandColor.autoHover;
|
|
113
|
+
}
|
|
114
|
+
if (settings.buttons.primary.backgroundColor.active === "Auto") {
|
|
115
|
+
data.buttons.primary.backgroundColor.active = settings.brandColor.autoActive;
|
|
116
|
+
}
|
|
117
|
+
if (settings.buttons.primary.border.color.color === "Auto") {
|
|
118
|
+
data.buttons.primary.border.color.color = settings.brandColor.background;
|
|
119
|
+
}
|
|
120
|
+
if (settings.buttons.primary.border.color.hover === "Auto") {
|
|
121
|
+
data.buttons.primary.border.color.hover = settings.brandColor.autoHover;
|
|
122
|
+
}
|
|
123
|
+
if (settings.buttons.primary.border.color.active === "Auto") {
|
|
124
|
+
data.buttons.primary.border.color.active = settings.brandColor.autoActive;
|
|
125
|
+
}
|
|
126
|
+
if (settings.buttons.secondary.textColor.color === "Auto") {
|
|
127
|
+
data.buttons.secondary.textColor.color = settings.brandColor.background;
|
|
128
|
+
}
|
|
129
|
+
if (settings.buttons.secondary.textColor.hover === "Auto") {
|
|
130
|
+
data.buttons.secondary.textColor.hover = settings.brandColor.background;
|
|
131
|
+
}
|
|
132
|
+
if (settings.buttons.secondary.textColor.active === "Auto") {
|
|
133
|
+
data.buttons.secondary.textColor.active = settings.brandColor.background;
|
|
134
|
+
}
|
|
135
|
+
if (settings.buttons.secondary.backgroundColor.background === "Auto") {
|
|
136
|
+
data.buttons.secondary.backgroundColor.background = settings.mainColor.background;
|
|
137
|
+
}
|
|
138
|
+
if (settings.buttons.secondary.backgroundColor.hover === "Auto") {
|
|
139
|
+
data.buttons.secondary.backgroundColor.hover = settings.mainColor.autoHover;
|
|
140
|
+
}
|
|
141
|
+
if (settings.buttons.secondary.backgroundColor.active === "Auto") {
|
|
142
|
+
data.buttons.secondary.backgroundColor.active = settings.mainColor.autoActive;
|
|
143
|
+
}
|
|
144
|
+
if (settings.buttons.secondary.border.color.color === "Auto") {
|
|
145
|
+
data.buttons.secondary.border.color.color = settings.brandColor.background;
|
|
146
|
+
}
|
|
147
|
+
if (settings.buttons.secondary.border.color.hover === "Auto") {
|
|
148
|
+
data.buttons.secondary.border.color.hover = settings.brandColor.background;
|
|
149
|
+
}
|
|
150
|
+
if (settings.buttons.secondary.border.color.active === "Auto") {
|
|
151
|
+
data.buttons.secondary.border.color.active = settings.brandColor.background;
|
|
152
|
+
}
|
|
153
|
+
if (settings.font.linkColor === "Auto") {
|
|
154
|
+
data.font.linkColor = settings.brandColor.background;
|
|
155
|
+
}
|
|
156
|
+
if (settings.xbutton.color === "Auto") {
|
|
157
|
+
data.xbutton.color = settings.brandColor.background;
|
|
158
|
+
}
|
|
159
|
+
if (((_a = settings == null ? void 0 : settings.progress) == null ? void 0 : _a.color) === "Auto") {
|
|
160
|
+
data.progress.color = settings.brandColor.background;
|
|
161
|
+
}
|
|
162
|
+
if (((_b = settings == null ? void 0 : settings.launcherBeacon) == null ? void 0 : _b.color) === "Auto") {
|
|
163
|
+
data.launcherBeacon.color = settings.brandColor.background;
|
|
164
|
+
}
|
|
165
|
+
if (((_d = (_c = settings == null ? void 0 : settings.launcherIcon) == null ? void 0 : _c.color) == null ? void 0 : _d.color) === "Auto") {
|
|
166
|
+
data.launcherIcon.color.color = settings.brandColor.background;
|
|
167
|
+
}
|
|
168
|
+
if (((_f = (_e = settings == null ? void 0 : settings.launcherIcon) == null ? void 0 : _e.color) == null ? void 0 : _f.hover) === "Auto") {
|
|
169
|
+
data.launcherIcon.color.hover = settings.brandColor.autoHover;
|
|
170
|
+
}
|
|
171
|
+
if (((_h = (_g = settings == null ? void 0 : settings.launcherIcon) == null ? void 0 : _g.color) == null ? void 0 : _h.active) === "Auto") {
|
|
172
|
+
data.launcherIcon.color.active = settings.brandColor.autoActive;
|
|
173
|
+
}
|
|
174
|
+
if (((_j = (_i = settings.checklistLauncher) == null ? void 0 : _i.color) == null ? void 0 : _j.color) === "Auto") {
|
|
175
|
+
data.checklistLauncher.color.color = settings.brandColor.color;
|
|
176
|
+
}
|
|
177
|
+
if (((_l = (_k = settings.checklistLauncher) == null ? void 0 : _k.color) == null ? void 0 : _l.background) === "Auto") {
|
|
178
|
+
data.checklistLauncher.color.background = settings.brandColor.background;
|
|
179
|
+
}
|
|
180
|
+
if (((_n = (_m = settings.checklistLauncher) == null ? void 0 : _m.color) == null ? void 0 : _n.hover) === "Auto") {
|
|
181
|
+
data.checklistLauncher.color.hover = settings.brandColor.autoHover;
|
|
182
|
+
}
|
|
183
|
+
if (((_p = (_o = settings.checklistLauncher) == null ? void 0 : _o.color) == null ? void 0 : _p.active) === "Auto") {
|
|
184
|
+
data.checklistLauncher.color.active = settings.brandColor.autoActive;
|
|
185
|
+
}
|
|
186
|
+
if (((_r = (_q = settings.checklistLauncher) == null ? void 0 : _q.counter) == null ? void 0 : _r.color) === "Auto") {
|
|
187
|
+
data.checklistLauncher.counter.color = settings.brandColor.background;
|
|
188
|
+
}
|
|
189
|
+
if (((_t = (_s = settings.checklistLauncher) == null ? void 0 : _s.counter) == null ? void 0 : _t.background) === "Auto") {
|
|
190
|
+
data.checklistLauncher.counter.background = settings.brandColor.color;
|
|
191
|
+
}
|
|
192
|
+
if (((_u = settings.survey) == null ? void 0 : _u.color) === "Auto") {
|
|
193
|
+
data.survey.color = settings.brandColor.background;
|
|
194
|
+
}
|
|
195
|
+
if (settings.font.fontFamily === "System font") {
|
|
196
|
+
data.font.fontFamily = defaultFontFamily;
|
|
197
|
+
} else {
|
|
198
|
+
data.font.fontFamily += ", sans-serif;";
|
|
199
|
+
}
|
|
200
|
+
return data;
|
|
201
|
+
};
|
|
202
|
+
var convertToCssVars = (settings, type = "tooltip") => {
|
|
203
|
+
const cssMapping = {
|
|
204
|
+
"--usertour-background": hexToHSLString(settings.mainColor.background),
|
|
205
|
+
"--usertour-foreground": hexToHSLString(settings.mainColor.color),
|
|
206
|
+
"--usertour-brand-active-background-color": hexToHSLString(
|
|
207
|
+
settings.brandColor.autoActive
|
|
208
|
+
),
|
|
209
|
+
"--usertour-brand-hover-background-color": hexToHSLString(
|
|
210
|
+
settings.brandColor.autoHover
|
|
211
|
+
),
|
|
212
|
+
"--usertour-font-family": settings.font.fontFamily,
|
|
213
|
+
"--usertour-font-size": `${settings.font.fontSize}px`,
|
|
214
|
+
"--usertour-main-background-color": settings.mainColor.background,
|
|
215
|
+
"--usertour-main-foreground-color": settings.mainColor.color,
|
|
216
|
+
"--usertour-main-hover-background-color": hexToHSLString(
|
|
217
|
+
settings.mainColor.autoHover
|
|
218
|
+
),
|
|
219
|
+
"--usertour-main-active-background-color": hexToHSLString(
|
|
220
|
+
settings.mainColor.autoActive
|
|
221
|
+
),
|
|
222
|
+
"--usertour-line-height": `${settings.font.lineHeight}px`,
|
|
223
|
+
"--usertour-widget-popper-border-radius": `${settings.border.borderRadius}px`,
|
|
224
|
+
"--usertour-font-weight-normal": settings.font.fontWeightNormal,
|
|
225
|
+
"--usertour-font-weight-bold": settings.font.fontWeightBold,
|
|
226
|
+
"--usertour-h1-font-size": `${settings.font.h1FontSize}px`,
|
|
227
|
+
"--usertour-h2-font-size": `${settings.font.h2FontSize}px`,
|
|
228
|
+
"--usertour-link-color": hexToHSLString(settings.font.linkColor),
|
|
229
|
+
"--usertour-widget-popper-border-width": settings.border.borderWidthEnabled ? `${settings.border.borderWidth}px` : "0px",
|
|
230
|
+
"--usertour-widget-popper-border-color": settings.border.borderColor,
|
|
231
|
+
"--usertour-button-border-radius": `${settings.buttons.borderRadius}px`,
|
|
232
|
+
"--usertour-button-height": `${settings.buttons.height}px`,
|
|
233
|
+
"--usertour-button-min-width": `${settings.buttons.minWidth}px`,
|
|
234
|
+
"--usertour-button-px": `${settings.buttons.px}px`,
|
|
235
|
+
"--usertour-primary": settings.buttons.primary.backgroundColor.background,
|
|
236
|
+
"--usertour-primary-hover": settings.buttons.primary.backgroundColor.hover,
|
|
237
|
+
"--usertour-primary-active": settings.buttons.primary.backgroundColor.active,
|
|
238
|
+
"--usertour-primary-foreground": settings.buttons.primary.textColor.color,
|
|
239
|
+
"--usertour-primary-foreground-hover": settings.buttons.primary.textColor.hover,
|
|
240
|
+
"--usertour-primary-foreground-active": settings.buttons.primary.textColor.active,
|
|
241
|
+
"--usertour-primary-border-width": settings.buttons.primary.border.enabled ? `${settings.buttons.primary.border.borderWidth}px` : "0px",
|
|
242
|
+
"--usertour-primary-border-color": settings.buttons.primary.border.color.color,
|
|
243
|
+
"--usertour-primary-border-hover": settings.buttons.primary.border.color.hover,
|
|
244
|
+
"--usertour-primary-border-active": settings.buttons.primary.border.color.active,
|
|
245
|
+
"--usertour-primary-font-weight": settings.buttons.primary.fontWeight,
|
|
246
|
+
"--usertour-secondary": settings.buttons.secondary.backgroundColor.background,
|
|
247
|
+
"--usertour-secondary-hover": settings.buttons.secondary.backgroundColor.hover,
|
|
248
|
+
"--usertour-secondary-active": settings.buttons.secondary.backgroundColor.active,
|
|
249
|
+
"--usertour-secondary-foreground": settings.buttons.secondary.textColor.color,
|
|
250
|
+
"--usertour-secondary-foreground-hover": settings.buttons.secondary.textColor.hover,
|
|
251
|
+
"--usertour-secondary-foreground-active": settings.buttons.secondary.textColor.active,
|
|
252
|
+
"--usertour-secondary-border-width": settings.buttons.secondary.border.enabled ? `${settings.buttons.secondary.border.borderWidth}px` : "0px",
|
|
253
|
+
"--usertour-secondary-border-color": settings.buttons.secondary.border.color.color,
|
|
254
|
+
"--usertour-secondary-border-hover": settings.buttons.secondary.border.color.hover,
|
|
255
|
+
"--usertour-secondary-border-active": settings.buttons.secondary.border.color.active,
|
|
256
|
+
"--usertour-secondary-font-weight": settings.buttons.secondary.fontWeight,
|
|
257
|
+
"--usertour-backdrop-color-rgb": hexToRGBStr(settings.backdrop.color),
|
|
258
|
+
"--usertour-backdrop-highlight-inset": settings.backdrop.highlight.type === "inside" ? "inset" : null,
|
|
259
|
+
"--usertour-backdrop-highlight-color-rgb": hexToRGBStr(settings.backdrop.highlight.color),
|
|
260
|
+
"--usertour-backdrop-highlight-opacity": settings.backdrop.highlight.opacity / 100,
|
|
261
|
+
"--usertour-backdrop-highlight-radius": `${settings.backdrop.highlight.radius}px`,
|
|
262
|
+
"--usertour-backdrop-highlight-spread": `${settings.backdrop.highlight.spread}px`,
|
|
263
|
+
"--usertour-backdrop-opacity": settings.backdrop.opacity / 100,
|
|
264
|
+
"--usertour-progress-bar-color": settings.progress.color,
|
|
265
|
+
"--usertour-progress-bar-height": `${settings.progress.height}px`,
|
|
266
|
+
"--usertour-narrow-progress-bar-height": `${settings.progress.narrowHeight}px`,
|
|
267
|
+
"--usertour-squared-progress-bar-height": `${settings.progress.chainSquaredHeight}px`,
|
|
268
|
+
"--usertour-rounded-progress-bar-height": `${settings.progress.chainRoundedHeight}px`,
|
|
269
|
+
"--usertour-dotted-progress-bar-height": `${settings.progress.dotsHeight}px`,
|
|
270
|
+
"--usertour-numbered-progress-bar-height": `${settings.progress.numberedHeight}px`,
|
|
271
|
+
"--usertour-widget-popper-padding": type === "modal" ? `${settings.modal.padding}px` : void 0,
|
|
272
|
+
"--usertour-xbutton": settings.xbutton.color,
|
|
273
|
+
"--usertour-widget-launcher-icon-color": settings.launcherIcon.color.color,
|
|
274
|
+
"--usertour-widget-launcher-icon-hover-color": settings.launcherIcon.color.hover,
|
|
275
|
+
"--usertour-widget-launcher-icon-active-color": settings.launcherIcon.color.active,
|
|
276
|
+
"--usertour-widget-launcher-icon-size": `${settings.launcherIcon.size}px`,
|
|
277
|
+
"--usertour-widget-beacon-color": settings.launcherBeacon.color,
|
|
278
|
+
"--usertour-widget-launcher-icon-opacity": settings.launcherIcon.opacity / 100,
|
|
279
|
+
"--usertour-widget-popper-padding-top": "2px",
|
|
280
|
+
"--usertour-widget-popper-padding-bottom": "2px",
|
|
281
|
+
"--usertour-checklist-trigger-active-background-color": settings.checklistLauncher.color.active,
|
|
282
|
+
"--usertour-checklist-trigger-background-color": settings.checklistLauncher.color.background,
|
|
283
|
+
"--usertour-checklist-trigger-border-radius": `${settings.checklistLauncher.borderRadius}px`,
|
|
284
|
+
"--usertour-checklist-trigger-counter-background-color": settings.checklistLauncher.counter.background,
|
|
285
|
+
"--usertour-checklist-trigger-counter-font-color": settings.checklistLauncher.counter.color,
|
|
286
|
+
"--usertour-checklist-trigger-font-color-rgb": settings.checklistLauncher.color.color,
|
|
287
|
+
"--usertour-checklist-trigger-font-color": settings.checklistLauncher.color.color,
|
|
288
|
+
"--usertour-checklist-trigger-font-weight": settings.checklistLauncher.fontWeight,
|
|
289
|
+
"--usertour-checkmark-background-color": settings.checklist.checkmarkColor,
|
|
290
|
+
"--usertour-checklist-trigger-height": `${settings.checklistLauncher.height}px`,
|
|
291
|
+
"--usertour-checklist-trigger-hover-background-color": settings.checklistLauncher.color.hover,
|
|
292
|
+
"--usertour-question-color": hexToHSLString(settings.survey.color)
|
|
293
|
+
};
|
|
294
|
+
let css = "";
|
|
295
|
+
for (const key in cssMapping) {
|
|
296
|
+
const value = cssMapping[key];
|
|
297
|
+
if (!isUndefined(value)) {
|
|
298
|
+
css += `${key}:${value};`;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return css;
|
|
302
|
+
};
|
|
303
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
304
|
+
0 && (module.exports = {
|
|
305
|
+
convertSettings,
|
|
306
|
+
convertToCssVars,
|
|
307
|
+
mergeThemeDefaultSettings
|
|
308
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThemeTypesSetting } from '@usertour/types';
|
|
2
|
+
|
|
3
|
+
declare const mergeThemeDefaultSettings: (settings: ThemeTypesSetting) => ThemeTypesSetting;
|
|
4
|
+
declare const convertSettings: (settings: ThemeTypesSetting) => ThemeTypesSetting;
|
|
5
|
+
declare const convertToCssVars: (settings: ThemeTypesSetting, type?: string) => string;
|
|
6
|
+
|
|
7
|
+
export { convertSettings, convertToCssVars, mergeThemeDefaultSettings };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThemeTypesSetting } from '@usertour/types';
|
|
2
|
+
|
|
3
|
+
declare const mergeThemeDefaultSettings: (settings: ThemeTypesSetting) => ThemeTypesSetting;
|
|
4
|
+
declare const convertSettings: (settings: ThemeTypesSetting) => ThemeTypesSetting;
|
|
5
|
+
declare const convertToCssVars: (settings: ThemeTypesSetting, type?: string) => string;
|
|
6
|
+
|
|
7
|
+
export { convertSettings, convertToCssVars, mergeThemeDefaultSettings };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
convertSettings,
|
|
3
|
+
convertToCssVars,
|
|
4
|
+
mergeThemeDefaultSettings
|
|
5
|
+
} from "./chunk-USHOKNHQ.js";
|
|
6
|
+
import "./chunk-GFH3VWOC.js";
|
|
7
|
+
import "./chunk-VT24VOAZ.js";
|
|
8
|
+
import "./chunk-XEO3YXBM.js";
|
|
9
|
+
export {
|
|
10
|
+
convertSettings,
|
|
11
|
+
convertToCssVars,
|
|
12
|
+
mergeThemeDefaultSettings
|
|
13
|
+
};
|
package/dist/error.cjs
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/error.ts
|
|
21
|
+
var error_exports = {};
|
|
22
|
+
__export(error_exports, {
|
|
23
|
+
getCodeError: () => getCodeError,
|
|
24
|
+
getContentError: () => getContentError,
|
|
25
|
+
getCurrentTimeError: () => getCurrentTimeError,
|
|
26
|
+
getElementError: () => getElementError,
|
|
27
|
+
getErrorMessage: () => getErrorMessage,
|
|
28
|
+
getNavitateError: () => getNavitateError,
|
|
29
|
+
getSegmentError: () => getSegmentError,
|
|
30
|
+
getStepError: () => getStepError,
|
|
31
|
+
getTextFillError: () => getTextFillError,
|
|
32
|
+
getTextInputError: () => getTextInputError,
|
|
33
|
+
getUrlPatternError: () => getUrlPatternError,
|
|
34
|
+
getUserAttrError: () => getUserAttrError,
|
|
35
|
+
getWaitError: () => getWaitError,
|
|
36
|
+
hasActionError: () => hasActionError,
|
|
37
|
+
hasError: () => hasError,
|
|
38
|
+
isValidSelector: () => isValidSelector
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(error_exports);
|
|
41
|
+
var import_types = require("@usertour/types");
|
|
42
|
+
var isValidSelector = (selector) => {
|
|
43
|
+
if (!selector) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (selector.type === "auto" && !selector.selectors) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (selector.type === "manual" && !selector.customSelector) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
};
|
|
54
|
+
var getUserAttrError = (data, attributes) => {
|
|
55
|
+
const ret = { showError: false, errorInfo: "" };
|
|
56
|
+
const item = attributes.find((item2) => item2.id === (data == null ? void 0 : data.attrId));
|
|
57
|
+
if (!(data == null ? void 0 : data.attrId) || !item) {
|
|
58
|
+
ret.showError = true;
|
|
59
|
+
ret.errorInfo = "Please select a attribute";
|
|
60
|
+
} else if ((data == null ? void 0 : data.logic) === "between" && (!(data == null ? void 0 : data.value) || !(data == null ? void 0 : data.value2))) {
|
|
61
|
+
ret.showError = true;
|
|
62
|
+
ret.errorInfo = "Please enter a value";
|
|
63
|
+
} else if ((item == null ? void 0 : item.dataType) !== import_types.AttributeDataType.Boolean) {
|
|
64
|
+
if (data.logic !== "any" && data.logic !== "empty") {
|
|
65
|
+
if ((item == null ? void 0 : item.dataType) === import_types.AttributeDataType.List) {
|
|
66
|
+
if (!data.listValues || data.listValues.length === 0) {
|
|
67
|
+
ret.showError = true;
|
|
68
|
+
ret.errorInfo = "Please enter a value";
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
if (!data.value || data.value === "") {
|
|
72
|
+
ret.showError = true;
|
|
73
|
+
ret.errorInfo = "Please enter a value";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return ret;
|
|
79
|
+
};
|
|
80
|
+
var getUrlPatternError = (data) => {
|
|
81
|
+
const ret = { showError: false, errorInfo: "" };
|
|
82
|
+
const hasExcludes = data.excludes && data.excludes.length > 0;
|
|
83
|
+
const hasIncludes = data.includes && data.includes.length > 0;
|
|
84
|
+
if (!hasExcludes && !hasIncludes) {
|
|
85
|
+
ret.showError = true;
|
|
86
|
+
ret.errorInfo = "Enter at least one URL pattern";
|
|
87
|
+
}
|
|
88
|
+
return ret;
|
|
89
|
+
};
|
|
90
|
+
var getCurrentTimeError = (data) => {
|
|
91
|
+
const ret = { showError: false, errorInfo: "" };
|
|
92
|
+
if (!data.startDate && !data.endDate) {
|
|
93
|
+
ret.showError = true;
|
|
94
|
+
ret.errorInfo = "Either start or end time be filled in";
|
|
95
|
+
}
|
|
96
|
+
return ret;
|
|
97
|
+
};
|
|
98
|
+
var getWaitError = (data) => {
|
|
99
|
+
const ret = { showError: false, errorInfo: "" };
|
|
100
|
+
if (data.second === void 0) {
|
|
101
|
+
ret.showError = true;
|
|
102
|
+
ret.errorInfo = "Enter wait time";
|
|
103
|
+
}
|
|
104
|
+
return ret;
|
|
105
|
+
};
|
|
106
|
+
var getElementError = (data) => {
|
|
107
|
+
const ret = { showError: false, errorInfo: "" };
|
|
108
|
+
if (!isValidSelector(data.elementData)) {
|
|
109
|
+
ret.showError = true;
|
|
110
|
+
ret.errorInfo = "Please select an element";
|
|
111
|
+
}
|
|
112
|
+
return ret;
|
|
113
|
+
};
|
|
114
|
+
var getTextInputError = (data) => {
|
|
115
|
+
const ret = { showError: false, errorInfo: "" };
|
|
116
|
+
if (data.logic !== "any" && data.logic !== "empty" && data.value === "") {
|
|
117
|
+
ret.showError = true;
|
|
118
|
+
ret.errorInfo = "Please enter a value";
|
|
119
|
+
} else if (!isValidSelector(data.elementData)) {
|
|
120
|
+
ret.showError = true;
|
|
121
|
+
ret.errorInfo = "Please select an element";
|
|
122
|
+
}
|
|
123
|
+
return ret;
|
|
124
|
+
};
|
|
125
|
+
var getTextFillError = (data) => {
|
|
126
|
+
const ret = { showError: false, errorInfo: "" };
|
|
127
|
+
if (!isValidSelector(data.elementData)) {
|
|
128
|
+
ret.showError = true;
|
|
129
|
+
ret.errorInfo = "Please select an element";
|
|
130
|
+
}
|
|
131
|
+
return ret;
|
|
132
|
+
};
|
|
133
|
+
var getSegmentError = (data) => {
|
|
134
|
+
const ret = { showError: false, errorInfo: "" };
|
|
135
|
+
if (!data.segmentId) {
|
|
136
|
+
ret.showError = true;
|
|
137
|
+
ret.errorInfo = "Please select an segment";
|
|
138
|
+
}
|
|
139
|
+
return ret;
|
|
140
|
+
};
|
|
141
|
+
var getContentError = (data) => {
|
|
142
|
+
const ret = { showError: false, errorInfo: "" };
|
|
143
|
+
if (!data.contentId) {
|
|
144
|
+
ret.showError = true;
|
|
145
|
+
ret.errorInfo = "Please select a flow";
|
|
146
|
+
}
|
|
147
|
+
return ret;
|
|
148
|
+
};
|
|
149
|
+
var getStepError = (data) => {
|
|
150
|
+
const ret = { showError: false, errorInfo: "" };
|
|
151
|
+
if (!data.stepCvid) {
|
|
152
|
+
ret.showError = true;
|
|
153
|
+
ret.errorInfo = "Please select a step";
|
|
154
|
+
}
|
|
155
|
+
return ret;
|
|
156
|
+
};
|
|
157
|
+
var getNavitateError = (data) => {
|
|
158
|
+
const ret = { showError: false, errorInfo: "" };
|
|
159
|
+
if (!data.value || data.value === "") {
|
|
160
|
+
ret.showError = true;
|
|
161
|
+
ret.errorInfo = "Enter the navigator url";
|
|
162
|
+
}
|
|
163
|
+
return ret;
|
|
164
|
+
};
|
|
165
|
+
var getCodeError = (data) => {
|
|
166
|
+
const ret = { showError: false, errorInfo: "" };
|
|
167
|
+
if (!data.value) {
|
|
168
|
+
ret.showError = true;
|
|
169
|
+
ret.errorInfo = "Enter the code ";
|
|
170
|
+
}
|
|
171
|
+
return ret;
|
|
172
|
+
};
|
|
173
|
+
var errorHandlerMapping = {
|
|
174
|
+
"current-page": getUrlPatternError,
|
|
175
|
+
"user-attr": getUserAttrError,
|
|
176
|
+
time: getCurrentTimeError,
|
|
177
|
+
wait: getWaitError,
|
|
178
|
+
element: getElementError,
|
|
179
|
+
"text-input": getTextInputError,
|
|
180
|
+
"text-fill": getTextFillError,
|
|
181
|
+
segment: getSegmentError,
|
|
182
|
+
content: getContentError
|
|
183
|
+
};
|
|
184
|
+
var hasError = (conds, attributes) => {
|
|
185
|
+
for (const cond of conds) {
|
|
186
|
+
const condType = cond.type;
|
|
187
|
+
const condErroFn = errorHandlerMapping[condType];
|
|
188
|
+
if (condErroFn) {
|
|
189
|
+
const { showError } = condErroFn(cond.data, attributes);
|
|
190
|
+
if (showError) {
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (cond.conditions) {
|
|
195
|
+
if (hasError(cond.conditions, attributes) === true) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return false;
|
|
201
|
+
};
|
|
202
|
+
var errorActionHandlerMapping = {
|
|
203
|
+
[import_types.ContentActionsItemType.STEP_GOTO]: getStepError,
|
|
204
|
+
[import_types.ContentActionsItemType.PAGE_NAVIGATE]: getNavitateError,
|
|
205
|
+
[import_types.ContentActionsItemType.FLOW_START]: getContentError,
|
|
206
|
+
[import_types.ContentActionsItemType.JAVASCRIPT_EVALUATE]: getCodeError
|
|
207
|
+
};
|
|
208
|
+
var hasActionError = (conds) => {
|
|
209
|
+
for (const cond of conds) {
|
|
210
|
+
const condType = cond.type;
|
|
211
|
+
const condErroFn = errorActionHandlerMapping[condType];
|
|
212
|
+
if (condErroFn) {
|
|
213
|
+
const { showError } = condErroFn(cond.data);
|
|
214
|
+
if (showError) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (cond.conditions) {
|
|
219
|
+
if (hasActionError(cond.conditions) === true) {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
};
|
|
226
|
+
function isErrorWithMessage(error) {
|
|
227
|
+
return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
|
|
228
|
+
}
|
|
229
|
+
function toErrorWithMessage(maybeError) {
|
|
230
|
+
if (isErrorWithMessage(maybeError))
|
|
231
|
+
return maybeError;
|
|
232
|
+
try {
|
|
233
|
+
return new Error(JSON.stringify(maybeError));
|
|
234
|
+
} catch {
|
|
235
|
+
return new Error(String(maybeError));
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function getErrorMessage(error) {
|
|
239
|
+
return toErrorWithMessage(error).message;
|
|
240
|
+
}
|
|
241
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
242
|
+
0 && (module.exports = {
|
|
243
|
+
getCodeError,
|
|
244
|
+
getContentError,
|
|
245
|
+
getCurrentTimeError,
|
|
246
|
+
getElementError,
|
|
247
|
+
getErrorMessage,
|
|
248
|
+
getNavitateError,
|
|
249
|
+
getSegmentError,
|
|
250
|
+
getStepError,
|
|
251
|
+
getTextFillError,
|
|
252
|
+
getTextInputError,
|
|
253
|
+
getUrlPatternError,
|
|
254
|
+
getUserAttrError,
|
|
255
|
+
getWaitError,
|
|
256
|
+
hasActionError,
|
|
257
|
+
hasError,
|
|
258
|
+
isValidSelector
|
|
259
|
+
});
|
package/dist/error.d.cts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ElementSelectorPropsData, RulesUserAttributeData, Attribute, RulesCondition } from '@usertour/types';
|
|
2
|
+
|
|
3
|
+
declare const isValidSelector: (selector: ElementSelectorPropsData) => boolean;
|
|
4
|
+
declare const getUserAttrError: (data: RulesUserAttributeData | undefined, attributes: Attribute[]) => {
|
|
5
|
+
showError: boolean;
|
|
6
|
+
errorInfo: string;
|
|
7
|
+
};
|
|
8
|
+
declare const getUrlPatternError: (data: any) => {
|
|
9
|
+
showError: boolean;
|
|
10
|
+
errorInfo: string;
|
|
11
|
+
};
|
|
12
|
+
declare const getCurrentTimeError: (data: any) => {
|
|
13
|
+
showError: boolean;
|
|
14
|
+
errorInfo: string;
|
|
15
|
+
};
|
|
16
|
+
declare const getWaitError: (data: any) => {
|
|
17
|
+
showError: boolean;
|
|
18
|
+
errorInfo: string;
|
|
19
|
+
};
|
|
20
|
+
declare const getElementError: (data: any) => {
|
|
21
|
+
showError: boolean;
|
|
22
|
+
errorInfo: string;
|
|
23
|
+
};
|
|
24
|
+
declare const getTextInputError: (data: any) => {
|
|
25
|
+
showError: boolean;
|
|
26
|
+
errorInfo: string;
|
|
27
|
+
};
|
|
28
|
+
declare const getTextFillError: (data: any) => {
|
|
29
|
+
showError: boolean;
|
|
30
|
+
errorInfo: string;
|
|
31
|
+
};
|
|
32
|
+
declare const getSegmentError: (data: any) => {
|
|
33
|
+
showError: boolean;
|
|
34
|
+
errorInfo: string;
|
|
35
|
+
};
|
|
36
|
+
declare const getContentError: (data: any) => {
|
|
37
|
+
showError: boolean;
|
|
38
|
+
errorInfo: string;
|
|
39
|
+
};
|
|
40
|
+
declare const getStepError: (data: any) => {
|
|
41
|
+
showError: boolean;
|
|
42
|
+
errorInfo: string;
|
|
43
|
+
};
|
|
44
|
+
declare const getNavitateError: (data: any) => {
|
|
45
|
+
showError: boolean;
|
|
46
|
+
errorInfo: string;
|
|
47
|
+
};
|
|
48
|
+
declare const getCodeError: (data: any) => {
|
|
49
|
+
showError: boolean;
|
|
50
|
+
errorInfo: string;
|
|
51
|
+
};
|
|
52
|
+
declare const hasError: (conds: RulesCondition[], attributes: Attribute[]) => boolean;
|
|
53
|
+
declare const hasActionError: (conds: RulesCondition[]) => boolean;
|
|
54
|
+
declare function getErrorMessage(error: unknown): string;
|
|
55
|
+
|
|
56
|
+
export { getCodeError, getContentError, getCurrentTimeError, getElementError, getErrorMessage, getNavitateError, getSegmentError, getStepError, getTextFillError, getTextInputError, getUrlPatternError, getUserAttrError, getWaitError, hasActionError, hasError, isValidSelector };
|