@uptrademedia/site-kit 1.0.8 → 1.0.10
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/api-CWtoFJCO.d.mts +137 -0
- package/dist/api-CWtoFJCO.d.ts +137 -0
- package/dist/{api-QUIPJJCX.js → api-UBHLAPUG.js} +20 -20
- package/dist/api-UBHLAPUG.js.map +1 -0
- package/dist/{api-V3BA5PMX.mjs → api-XNF6Q5HO.mjs} +3 -3
- package/dist/api-XNF6Q5HO.mjs.map +1 -0
- package/dist/blog/index.d.mts +131 -5
- package/dist/blog/index.d.ts +131 -5
- package/dist/blog/index.js +532 -302
- package/dist/blog/index.js.map +1 -1
- package/dist/blog/index.mjs +532 -302
- package/dist/blog/index.mjs.map +1 -1
- package/dist/{chunk-QQB4FO4Q.js → chunk-AWAJEIZS.js} +11 -8
- package/dist/chunk-AWAJEIZS.js.map +1 -0
- package/dist/{chunk-MB3WR5KJ.mjs → chunk-CDJL2YGL.mjs} +61 -443
- package/dist/chunk-CDJL2YGL.mjs.map +1 -0
- package/dist/{chunk-TDK7DLCH.js → chunk-FLAA4ZJO.js} +59 -448
- package/dist/chunk-FLAA4ZJO.js.map +1 -0
- package/dist/{chunk-JGQPAXTL.mjs → chunk-H5AGHERY.mjs} +8 -5
- package/dist/chunk-H5AGHERY.mjs.map +1 -0
- package/dist/{chunk-VDI7KYME.js → chunk-IYVJGUYX.js} +8 -4
- package/dist/chunk-IYVJGUYX.js.map +1 -0
- package/dist/{chunk-FQVGK746.mjs → chunk-SKHOW2CI.mjs} +8 -4
- package/dist/chunk-SKHOW2CI.mjs.map +1 -0
- package/dist/cli/index.js +32 -25
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +32 -25
- package/dist/cli/index.mjs.map +1 -1
- package/dist/images/index.d.mts +49 -126
- package/dist/images/index.d.ts +49 -126
- package/dist/images/index.js +12 -12
- package/dist/images/index.mjs +1 -5
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +510 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +440 -13
- package/dist/index.mjs.map +1 -1
- package/dist/{routing-CIOFpFCB.d.mts → routing-BT0RrBLk.d.mts} +14 -1
- package/dist/{routing-CF91y6NO.d.ts → routing-wmNSxSvP.d.ts} +14 -1
- package/dist/seo/index.d.mts +37 -4
- package/dist/seo/index.d.ts +37 -4
- package/dist/seo/index.js +48 -18
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +34 -5
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo/server.d.mts +15 -4
- package/dist/seo/server.d.ts +15 -4
- package/dist/seo/server.js +16 -16
- package/dist/seo/server.mjs +2 -2
- package/dist/{types-j8X4vUhB.d.mts → types-wf4dwNMO.d.mts} +5 -0
- package/dist/{types-j8X4vUhB.d.ts → types-wf4dwNMO.d.ts} +5 -0
- package/package.json +6 -1
- package/dist/api-QUIPJJCX.js.map +0 -1
- package/dist/api-V3BA5PMX.mjs.map +0 -1
- package/dist/chunk-FQVGK746.mjs.map +0 -1
- package/dist/chunk-JGQPAXTL.mjs.map +0 -1
- package/dist/chunk-MB3WR5KJ.mjs.map +0 -1
- package/dist/chunk-QQB4FO4Q.js.map +0 -1
- package/dist/chunk-TDK7DLCH.js.map +0 -1
- package/dist/chunk-VDI7KYME.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -5,27 +5,455 @@ var chunkVOR53RUR_js = require('./chunk-VOR53RUR.js');
|
|
|
5
5
|
var chunkK2HWVOEO_js = require('./chunk-K2HWVOEO.js');
|
|
6
6
|
var chunk5R4R3WDP_js = require('./chunk-5R4R3WDP.js');
|
|
7
7
|
var chunkBZBJVG5Y_js = require('./chunk-BZBJVG5Y.js');
|
|
8
|
-
var
|
|
9
|
-
require('./chunk-HCFPU7TU.js');
|
|
10
|
-
require('./chunk-JUEVN4Q4.js');
|
|
11
|
-
require('./chunk-FLZZOX44.js');
|
|
12
|
-
require('./chunk-ADHVEFWD.js');
|
|
8
|
+
var chunkFLAA4ZJO_js = require('./chunk-FLAA4ZJO.js');
|
|
9
|
+
var chunkHCFPU7TU_js = require('./chunk-HCFPU7TU.js');
|
|
10
|
+
var chunkJUEVN4Q4_js = require('./chunk-JUEVN4Q4.js');
|
|
11
|
+
var chunkFLZZOX44_js = require('./chunk-FLZZOX44.js');
|
|
12
|
+
var chunkADHVEFWD_js = require('./chunk-ADHVEFWD.js');
|
|
13
13
|
require('./chunk-ZSMWDLMK.js');
|
|
14
|
-
var
|
|
14
|
+
var React3 = require('react');
|
|
15
15
|
var jsxRuntime = require('react/jsx-runtime');
|
|
16
16
|
|
|
17
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
var SignalContext = React3.createContext(null);
|
|
22
|
+
function useSignal() {
|
|
23
|
+
const context = React3.useContext(SignalContext);
|
|
24
|
+
if (!context) {
|
|
25
|
+
throw new Error("useSignal must be used within a SignalBridge");
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
22
29
|
function getApiConfig() {
|
|
30
|
+
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || "https://api.uptrademedia.com" : "https://api.uptrademedia.com";
|
|
31
|
+
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ : void 0;
|
|
32
|
+
return { apiUrl, apiKey };
|
|
33
|
+
}
|
|
34
|
+
function getVisitorId() {
|
|
35
|
+
if (typeof window === "undefined") return "";
|
|
36
|
+
const key = "_uptrade_vid";
|
|
37
|
+
let visitorId = localStorage.getItem(key);
|
|
38
|
+
if (!visitorId) {
|
|
39
|
+
visitorId = crypto.randomUUID();
|
|
40
|
+
localStorage.setItem(key, visitorId);
|
|
41
|
+
}
|
|
42
|
+
return visitorId;
|
|
43
|
+
}
|
|
44
|
+
function getSessionId() {
|
|
45
|
+
if (typeof window === "undefined") return "";
|
|
46
|
+
const key = "_uptrade_sid";
|
|
47
|
+
let sessionId = sessionStorage.getItem(key);
|
|
48
|
+
if (!sessionId) {
|
|
49
|
+
sessionId = crypto.randomUUID();
|
|
50
|
+
sessionStorage.setItem(key, sessionId);
|
|
51
|
+
}
|
|
52
|
+
return sessionId;
|
|
53
|
+
}
|
|
54
|
+
function getDeviceType() {
|
|
55
|
+
if (typeof window === "undefined") return "desktop";
|
|
56
|
+
const ua = navigator.userAgent;
|
|
57
|
+
if (/tablet|ipad|playbook|silk/i.test(ua)) return "tablet";
|
|
58
|
+
if (/mobile|iphone|ipod|android|blackberry|opera mini|iemobile/i.test(ua)) return "mobile";
|
|
59
|
+
return "desktop";
|
|
60
|
+
}
|
|
61
|
+
function getBrowser() {
|
|
62
|
+
if (typeof window === "undefined") return "unknown";
|
|
63
|
+
const ua = navigator.userAgent;
|
|
64
|
+
if (ua.includes("Firefox")) return "Firefox";
|
|
65
|
+
if (ua.includes("Edg")) return "Edge";
|
|
66
|
+
if (ua.includes("Chrome")) return "Chrome";
|
|
67
|
+
if (ua.includes("Safari")) return "Safari";
|
|
68
|
+
return "Other";
|
|
69
|
+
}
|
|
70
|
+
function getOS() {
|
|
71
|
+
if (typeof window === "undefined") return "unknown";
|
|
72
|
+
const ua = navigator.userAgent;
|
|
73
|
+
if (ua.includes("Windows")) return "Windows";
|
|
74
|
+
if (ua.includes("Mac")) return "macOS";
|
|
75
|
+
if (ua.includes("iPhone") || ua.includes("iPad")) return "iOS";
|
|
76
|
+
if (ua.includes("Android")) return "Android";
|
|
77
|
+
if (ua.includes("Linux")) return "Linux";
|
|
78
|
+
return "Other";
|
|
79
|
+
}
|
|
80
|
+
function SignalBridge({
|
|
81
|
+
enabled = true,
|
|
82
|
+
realtime = true,
|
|
83
|
+
experiments = true,
|
|
84
|
+
behaviorTracking = true,
|
|
85
|
+
children
|
|
86
|
+
}) {
|
|
87
|
+
const [config, setConfig] = React3.useState(null);
|
|
88
|
+
const [loading, setLoading] = React3.useState(true);
|
|
89
|
+
const [error, setError] = React3.useState(null);
|
|
90
|
+
const eventSourceRef = React3.useRef(null);
|
|
91
|
+
const eventQueueRef = React3.useRef([]);
|
|
92
|
+
const flushTimeoutRef = React3.useRef(null);
|
|
93
|
+
const assignmentsRef = React3.useRef(/* @__PURE__ */ new Map());
|
|
94
|
+
const pageLoadTimeRef = React3.useRef(Date.now());
|
|
95
|
+
const scrollDepthRef = React3.useRef(0);
|
|
96
|
+
const clickCountRef = React3.useRef(0);
|
|
97
|
+
const { apiUrl, apiKey } = getApiConfig();
|
|
98
|
+
const fetchConfig = React3.useCallback(async () => {
|
|
99
|
+
if (!apiKey || !enabled) {
|
|
100
|
+
setLoading(false);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const response = await fetch(`${apiUrl}/api/public/signal/config`, {
|
|
105
|
+
headers: {
|
|
106
|
+
"x-api-key": apiKey,
|
|
107
|
+
"x-visitor-id": getVisitorId()
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
if (!response.ok) {
|
|
111
|
+
throw new Error(`Failed to fetch Signal config: ${response.statusText}`);
|
|
112
|
+
}
|
|
113
|
+
const data = await response.json();
|
|
114
|
+
setConfig(data.config);
|
|
115
|
+
setError(null);
|
|
116
|
+
if (experiments && data.config?.experiments) {
|
|
117
|
+
for (const exp of data.config.experiments) {
|
|
118
|
+
if (exp.status === "running") {
|
|
119
|
+
await loadExperimentAssignment(exp.id);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
} catch (err) {
|
|
124
|
+
console.error("[Signal] Config fetch error:", err);
|
|
125
|
+
setError(err);
|
|
126
|
+
} finally {
|
|
127
|
+
setLoading(false);
|
|
128
|
+
}
|
|
129
|
+
}, [apiUrl, apiKey, enabled, experiments]);
|
|
130
|
+
const connectSSE = React3.useCallback(() => {
|
|
131
|
+
if (!apiKey || !enabled || !realtime) return;
|
|
132
|
+
if (eventSourceRef.current) {
|
|
133
|
+
eventSourceRef.current.close();
|
|
134
|
+
}
|
|
135
|
+
const url = `${apiUrl}/api/public/signal/stream?key=${apiKey}`;
|
|
136
|
+
const eventSource = new EventSource(url);
|
|
137
|
+
eventSource.addEventListener("config_update", (e) => {
|
|
138
|
+
try {
|
|
139
|
+
const { config: newConfig, version } = JSON.parse(e.data);
|
|
140
|
+
setConfig((prev) => {
|
|
141
|
+
if (prev?.version !== version) {
|
|
142
|
+
console.log("[Signal] Config updated to version:", version);
|
|
143
|
+
return newConfig;
|
|
144
|
+
}
|
|
145
|
+
return prev;
|
|
146
|
+
});
|
|
147
|
+
} catch (err) {
|
|
148
|
+
console.error("[Signal] SSE parse error:", err);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
eventSource.addEventListener("experiment_update", (e) => {
|
|
152
|
+
try {
|
|
153
|
+
const { experiment_id, action } = JSON.parse(e.data);
|
|
154
|
+
if (action === "started" || action === "updated") {
|
|
155
|
+
loadExperimentAssignment(experiment_id);
|
|
156
|
+
} else if (action === "stopped") {
|
|
157
|
+
assignmentsRef.current.delete(experiment_id);
|
|
158
|
+
}
|
|
159
|
+
} catch (err) {
|
|
160
|
+
console.error("[Signal] Experiment update error:", err);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
eventSource.onerror = () => {
|
|
164
|
+
console.warn("[Signal] SSE connection error, reconnecting...");
|
|
165
|
+
eventSource.close();
|
|
166
|
+
setTimeout(connectSSE, 5e3);
|
|
167
|
+
};
|
|
168
|
+
eventSourceRef.current = eventSource;
|
|
169
|
+
}, [apiUrl, apiKey, enabled, realtime]);
|
|
170
|
+
const loadExperimentAssignment = React3.useCallback(async (experimentId) => {
|
|
171
|
+
const storageKey = `_signal_exp_${experimentId}`;
|
|
172
|
+
const stored = localStorage.getItem(storageKey);
|
|
173
|
+
if (stored) {
|
|
174
|
+
try {
|
|
175
|
+
const assignment = JSON.parse(stored);
|
|
176
|
+
if (assignment.expires > Date.now()) {
|
|
177
|
+
assignmentsRef.current.set(experimentId, assignment);
|
|
178
|
+
return assignment;
|
|
179
|
+
}
|
|
180
|
+
} catch {
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
const response = await fetch(`${apiUrl}/api/public/signal/experiment/${experimentId}`, {
|
|
185
|
+
headers: {
|
|
186
|
+
"x-api-key": apiKey,
|
|
187
|
+
"x-visitor-id": getVisitorId()
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
if (!response.ok) return null;
|
|
191
|
+
const assignment = await response.json();
|
|
192
|
+
localStorage.setItem(storageKey, JSON.stringify(assignment));
|
|
193
|
+
assignmentsRef.current.set(experimentId, assignment);
|
|
194
|
+
return assignment;
|
|
195
|
+
} catch (err) {
|
|
196
|
+
console.error("[Signal] Experiment assignment error:", err);
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
}, [apiUrl, apiKey]);
|
|
200
|
+
const getExperiment = React3.useCallback((experimentId) => {
|
|
201
|
+
return assignmentsRef.current.get(experimentId) || null;
|
|
202
|
+
}, []);
|
|
203
|
+
const flushEvents = React3.useCallback(async () => {
|
|
204
|
+
if (eventQueueRef.current.length === 0) return;
|
|
205
|
+
const events = [...eventQueueRef.current];
|
|
206
|
+
eventQueueRef.current = [];
|
|
207
|
+
try {
|
|
208
|
+
await fetch(`${apiUrl}/api/public/signal/events`, {
|
|
209
|
+
method: "POST",
|
|
210
|
+
headers: {
|
|
211
|
+
"Content-Type": "application/json",
|
|
212
|
+
"x-api-key": apiKey
|
|
213
|
+
},
|
|
214
|
+
body: JSON.stringify({
|
|
215
|
+
visitor_id: getVisitorId(),
|
|
216
|
+
session_id: getSessionId(),
|
|
217
|
+
events
|
|
218
|
+
})
|
|
219
|
+
});
|
|
220
|
+
} catch (err) {
|
|
221
|
+
eventQueueRef.current = [...events, ...eventQueueRef.current];
|
|
222
|
+
console.error("[Signal] Event flush error:", err);
|
|
223
|
+
}
|
|
224
|
+
}, [apiUrl, apiKey]);
|
|
225
|
+
const trackEvent = React3.useCallback((event) => {
|
|
226
|
+
if (!enabled || !apiKey) return;
|
|
227
|
+
const enrichedEvent = {
|
|
228
|
+
...event,
|
|
229
|
+
page_url: window.location.href,
|
|
230
|
+
page_path: window.location.pathname,
|
|
231
|
+
referrer: document.referrer,
|
|
232
|
+
device_type: getDeviceType(),
|
|
233
|
+
browser: getBrowser(),
|
|
234
|
+
os: getOS(),
|
|
235
|
+
viewport_width: window.innerWidth,
|
|
236
|
+
viewport_height: window.innerHeight,
|
|
237
|
+
time_on_page: Date.now() - pageLoadTimeRef.current,
|
|
238
|
+
scroll_depth: scrollDepthRef.current,
|
|
239
|
+
click_count: clickCountRef.current,
|
|
240
|
+
experiments: Array.from(assignmentsRef.current.values()).map((a) => ({
|
|
241
|
+
experiment_id: a.experiment_id,
|
|
242
|
+
variant_key: a.variant_key
|
|
243
|
+
})),
|
|
244
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
245
|
+
};
|
|
246
|
+
eventQueueRef.current.push(enrichedEvent);
|
|
247
|
+
if (flushTimeoutRef.current) {
|
|
248
|
+
clearTimeout(flushTimeoutRef.current);
|
|
249
|
+
}
|
|
250
|
+
flushTimeoutRef.current = setTimeout(flushEvents, 1e3);
|
|
251
|
+
}, [enabled, apiKey, flushEvents]);
|
|
252
|
+
const trackOutcome = React3.useCallback(async (outcome) => {
|
|
253
|
+
if (!enabled || !apiKey) return;
|
|
254
|
+
try {
|
|
255
|
+
await fetch(`${apiUrl}/api/public/signal/outcome`, {
|
|
256
|
+
method: "POST",
|
|
257
|
+
headers: {
|
|
258
|
+
"Content-Type": "application/json",
|
|
259
|
+
"x-api-key": apiKey
|
|
260
|
+
},
|
|
261
|
+
body: JSON.stringify({
|
|
262
|
+
...outcome,
|
|
263
|
+
visitor_id: getVisitorId(),
|
|
264
|
+
session_id: getSessionId(),
|
|
265
|
+
experiments: Array.from(assignmentsRef.current.keys()),
|
|
266
|
+
page_url: window.location.href,
|
|
267
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
268
|
+
})
|
|
269
|
+
});
|
|
270
|
+
} catch (err) {
|
|
271
|
+
console.error("[Signal] Outcome tracking error:", err);
|
|
272
|
+
}
|
|
273
|
+
}, [apiUrl, apiKey, enabled]);
|
|
274
|
+
React3.useEffect(() => {
|
|
275
|
+
if (!behaviorTracking || typeof window === "undefined") return;
|
|
276
|
+
const handleScroll = () => {
|
|
277
|
+
const scrollTop = window.scrollY;
|
|
278
|
+
const docHeight = document.documentElement.scrollHeight - window.innerHeight;
|
|
279
|
+
const depth = docHeight > 0 ? Math.round(scrollTop / docHeight * 100) : 0;
|
|
280
|
+
scrollDepthRef.current = Math.max(scrollDepthRef.current, depth);
|
|
281
|
+
};
|
|
282
|
+
const handleClick = () => {
|
|
283
|
+
clickCountRef.current++;
|
|
284
|
+
};
|
|
285
|
+
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
286
|
+
window.addEventListener("click", handleClick);
|
|
287
|
+
const handleVisibilityChange = () => {
|
|
288
|
+
if (document.visibilityState === "hidden") {
|
|
289
|
+
flushEvents();
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
293
|
+
window.addEventListener("beforeunload", flushEvents);
|
|
294
|
+
return () => {
|
|
295
|
+
window.removeEventListener("scroll", handleScroll);
|
|
296
|
+
window.removeEventListener("click", handleClick);
|
|
297
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
298
|
+
window.removeEventListener("beforeunload", flushEvents);
|
|
299
|
+
};
|
|
300
|
+
}, [behaviorTracking, flushEvents]);
|
|
301
|
+
React3.useEffect(() => {
|
|
302
|
+
fetchConfig();
|
|
303
|
+
}, [fetchConfig]);
|
|
304
|
+
React3.useEffect(() => {
|
|
305
|
+
if (config && realtime) {
|
|
306
|
+
connectSSE();
|
|
307
|
+
}
|
|
308
|
+
return () => {
|
|
309
|
+
if (eventSourceRef.current) {
|
|
310
|
+
eventSourceRef.current.close();
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}, [config, realtime, connectSSE]);
|
|
314
|
+
const contextValue = React3.useMemo(() => ({
|
|
315
|
+
config,
|
|
316
|
+
loading,
|
|
317
|
+
error,
|
|
318
|
+
trackEvent,
|
|
319
|
+
trackOutcome,
|
|
320
|
+
getExperiment,
|
|
321
|
+
refreshConfig: fetchConfig
|
|
322
|
+
}), [config, loading, error, trackEvent, trackOutcome, getExperiment, fetchConfig]);
|
|
323
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SignalContext.Provider, { value: contextValue, children });
|
|
324
|
+
}
|
|
325
|
+
function useSignalConfig() {
|
|
326
|
+
const { config } = useSignal();
|
|
327
|
+
return config;
|
|
328
|
+
}
|
|
329
|
+
function useSignalEvent() {
|
|
330
|
+
const { trackEvent } = useSignal();
|
|
331
|
+
return trackEvent;
|
|
332
|
+
}
|
|
333
|
+
function useSignalOutcome() {
|
|
334
|
+
const { trackOutcome } = useSignal();
|
|
335
|
+
return { trackOutcome };
|
|
336
|
+
}
|
|
337
|
+
function useSignalExperiment(experimentId) {
|
|
338
|
+
const { getExperiment, config } = useSignal();
|
|
339
|
+
const assignment = getExperiment(experimentId);
|
|
340
|
+
const experiment = config?.experiments?.find((e) => e.id === experimentId);
|
|
341
|
+
const isRunning = experiment?.status === "running";
|
|
342
|
+
return {
|
|
343
|
+
assignment: isRunning ? assignment : null,
|
|
344
|
+
variant: isRunning && assignment ? assignment.variant_key : null,
|
|
345
|
+
isControl: !assignment || assignment.variant_key === "control"
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
var SiteKitContext = React3.createContext(null);
|
|
349
|
+
function useSiteKit() {
|
|
350
|
+
const context = React3.useContext(SiteKitContext);
|
|
351
|
+
if (!context) {
|
|
352
|
+
throw new Error("useSiteKit must be used within a SiteKitProvider");
|
|
353
|
+
}
|
|
354
|
+
return context;
|
|
355
|
+
}
|
|
356
|
+
function SiteKitProvider({
|
|
357
|
+
children,
|
|
358
|
+
apiKey,
|
|
359
|
+
apiUrl,
|
|
360
|
+
signalUrl,
|
|
361
|
+
analytics,
|
|
362
|
+
engage,
|
|
363
|
+
forms,
|
|
364
|
+
signal,
|
|
365
|
+
debug = false
|
|
366
|
+
}) {
|
|
367
|
+
const finalApiUrl = apiUrl || "https://api.uptrademedia.com";
|
|
368
|
+
const finalSignalUrl = signalUrl || "https://signal.uptrademedia.com";
|
|
369
|
+
if (!apiKey) {
|
|
370
|
+
console.error("@uptrade/site-kit: No API key provided. Set NEXT_PUBLIC_UPTRADE_API_KEY environment variable.");
|
|
371
|
+
}
|
|
372
|
+
React3.useEffect(() => {
|
|
373
|
+
if (typeof window !== "undefined") {
|
|
374
|
+
window.__SITE_KIT_API_URL__ = finalApiUrl;
|
|
375
|
+
window.__SITE_KIT_SIGNAL_URL__ = finalSignalUrl;
|
|
376
|
+
window.__SITE_KIT_API_KEY__ = apiKey;
|
|
377
|
+
window.__SITE_KIT_DEBUG__ = debug;
|
|
378
|
+
}
|
|
379
|
+
if (apiKey) {
|
|
380
|
+
chunkADHVEFWD_js.configureFormsApi({
|
|
381
|
+
baseUrl: finalApiUrl,
|
|
382
|
+
apiKey
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}, [finalApiUrl, finalSignalUrl, apiKey, debug]);
|
|
386
|
+
const contextValue = React3.useMemo(
|
|
387
|
+
() => ({
|
|
388
|
+
apiUrl: finalApiUrl,
|
|
389
|
+
signalUrl: finalSignalUrl,
|
|
390
|
+
apiKey,
|
|
391
|
+
analytics,
|
|
392
|
+
engage,
|
|
393
|
+
forms,
|
|
394
|
+
signal,
|
|
395
|
+
debug,
|
|
396
|
+
isReady: true
|
|
397
|
+
}),
|
|
398
|
+
[finalApiUrl, finalSignalUrl, apiKey, analytics, engage, forms, signal, debug]
|
|
399
|
+
);
|
|
400
|
+
let content = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
401
|
+
if (signal?.enabled) {
|
|
402
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(
|
|
403
|
+
SignalBridge,
|
|
404
|
+
{
|
|
405
|
+
enabled: signal.enabled,
|
|
406
|
+
realtime: signal.realtime !== false,
|
|
407
|
+
experiments: signal.experiments !== false,
|
|
408
|
+
behaviorTracking: signal.behaviorTracking !== false,
|
|
409
|
+
children: content
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
if (analytics?.enabled) {
|
|
414
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(React3.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
+
chunkJUEVN4Q4_js.AnalyticsProvider,
|
|
416
|
+
{
|
|
417
|
+
apiUrl: finalApiUrl,
|
|
418
|
+
apiKey,
|
|
419
|
+
trackPageViews: analytics.trackPageViews !== false,
|
|
420
|
+
trackWebVitals: analytics.trackWebVitals !== false,
|
|
421
|
+
trackScrollDepth: analytics.trackScrollDepth !== false,
|
|
422
|
+
trackClicks: analytics.trackClicks !== false,
|
|
423
|
+
debug,
|
|
424
|
+
children: content
|
|
425
|
+
}
|
|
426
|
+
) });
|
|
427
|
+
}
|
|
428
|
+
if (engage?.enabled) {
|
|
429
|
+
content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
430
|
+
content,
|
|
431
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
432
|
+
chunkFLZZOX44_js.EngageWidget,
|
|
433
|
+
{
|
|
434
|
+
apiUrl: finalApiUrl,
|
|
435
|
+
apiKey,
|
|
436
|
+
position: engage.position || "bottom-right",
|
|
437
|
+
chatEnabled: engage.chatEnabled !== false
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
] });
|
|
441
|
+
}
|
|
442
|
+
content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
443
|
+
content,
|
|
444
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkHCFPU7TU_js.SitemapSync, { debug })
|
|
445
|
+
] });
|
|
446
|
+
return /* @__PURE__ */ jsxRuntime.jsx(SiteKitContext.Provider, { value: contextValue, children: content });
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// src/affiliates/api.ts
|
|
450
|
+
function getApiConfig2() {
|
|
23
451
|
const apiUrl = typeof window !== "undefined" ? window.__SITE_KIT_API_URL__ || "https://api.uptrademedia.com" : "https://api.uptrademedia.com";
|
|
24
452
|
const apiKey = typeof window !== "undefined" ? window.__SITE_KIT_API_KEY__ || "" : "";
|
|
25
453
|
return { apiUrl, apiKey };
|
|
26
454
|
}
|
|
27
455
|
async function apiGet(endpoint) {
|
|
28
|
-
const { apiUrl, apiKey } =
|
|
456
|
+
const { apiUrl, apiKey } = getApiConfig2();
|
|
29
457
|
if (!apiKey) {
|
|
30
458
|
console.error("[Affiliates] No API key configured");
|
|
31
459
|
return null;
|
|
@@ -54,14 +482,14 @@ async function fetchAffiliates(options = {}) {
|
|
|
54
482
|
return result?.affiliates || [];
|
|
55
483
|
}
|
|
56
484
|
function getTrackingUrl(affiliateId, offerId) {
|
|
57
|
-
const { apiUrl } =
|
|
485
|
+
const { apiUrl } = getApiConfig2();
|
|
58
486
|
return `${apiUrl}/a/${affiliateId}/${offerId}`;
|
|
59
487
|
}
|
|
60
488
|
function useAffiliates() {
|
|
61
|
-
const [affiliates, setAffiliates] =
|
|
62
|
-
const [isLoading, setIsLoading] =
|
|
63
|
-
const [error, setError] =
|
|
64
|
-
|
|
489
|
+
const [affiliates, setAffiliates] = React3.useState([]);
|
|
490
|
+
const [isLoading, setIsLoading] = React3.useState(true);
|
|
491
|
+
const [error, setError] = React3.useState(null);
|
|
492
|
+
React3.useEffect(() => {
|
|
65
493
|
async function load() {
|
|
66
494
|
try {
|
|
67
495
|
setIsLoading(true);
|
|
@@ -165,9 +593,9 @@ function SignalExperiment({
|
|
|
165
593
|
trackImpression = true,
|
|
166
594
|
children
|
|
167
595
|
}) {
|
|
168
|
-
const { assignment, variant, isControl } =
|
|
169
|
-
const trackEvent =
|
|
170
|
-
|
|
596
|
+
const { assignment, variant, isControl } = useSignalExperiment(experimentId);
|
|
597
|
+
const trackEvent = useSignalEvent();
|
|
598
|
+
React3.useEffect(() => {
|
|
171
599
|
if (trackImpression && variant) {
|
|
172
600
|
trackEvent({
|
|
173
601
|
event_type: "experiment",
|
|
@@ -193,7 +621,7 @@ function SignalExperiment({
|
|
|
193
621
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: variants.control || null });
|
|
194
622
|
}
|
|
195
623
|
function useExperimentVariant(experimentId) {
|
|
196
|
-
return
|
|
624
|
+
return useSignalExperiment(experimentId);
|
|
197
625
|
}
|
|
198
626
|
function ExperimentConversion({
|
|
199
627
|
experimentId,
|
|
@@ -201,8 +629,8 @@ function ExperimentConversion({
|
|
|
201
629
|
value,
|
|
202
630
|
children
|
|
203
631
|
}) {
|
|
204
|
-
const trackEvent =
|
|
205
|
-
const { variant } =
|
|
632
|
+
const trackEvent = useSignalEvent();
|
|
633
|
+
const { variant } = useSignalExperiment(experimentId);
|
|
206
634
|
const handleInteraction = () => {
|
|
207
635
|
trackEvent({
|
|
208
636
|
event_type: "experiment",
|
|
@@ -215,7 +643,7 @@ function ExperimentConversion({
|
|
|
215
643
|
}
|
|
216
644
|
});
|
|
217
645
|
};
|
|
218
|
-
return
|
|
646
|
+
return React3__default.default.cloneElement(children, {
|
|
219
647
|
onClick: (e) => {
|
|
220
648
|
handleInteraction();
|
|
221
649
|
if (children.props.onClick) {
|
|
@@ -435,11 +863,11 @@ function SetupAssistant({
|
|
|
435
863
|
onComplete,
|
|
436
864
|
welcomeMessage
|
|
437
865
|
}) {
|
|
438
|
-
const [messages, setMessages] =
|
|
439
|
-
const [input, setInput] =
|
|
440
|
-
const [isTyping, setIsTyping] =
|
|
441
|
-
const [isExtracting, setIsExtracting] =
|
|
442
|
-
const [state, setState] =
|
|
866
|
+
const [messages, setMessages] = React3.useState([]);
|
|
867
|
+
const [input, setInput] = React3.useState("");
|
|
868
|
+
const [isTyping, setIsTyping] = React3.useState(false);
|
|
869
|
+
const [isExtracting, setIsExtracting] = React3.useState(false);
|
|
870
|
+
const [state, setState] = React3.useState({
|
|
443
871
|
step: "welcome",
|
|
444
872
|
isAuthenticated: !!authToken,
|
|
445
873
|
selectedModules: ["analytics", "seo", "forms"],
|
|
@@ -452,10 +880,10 @@ function SetupAssistant({
|
|
|
452
880
|
org_id: orgId
|
|
453
881
|
}
|
|
454
882
|
});
|
|
455
|
-
const messagesEndRef =
|
|
456
|
-
const inputRef =
|
|
457
|
-
const streamingMessageRef =
|
|
458
|
-
const sendToSignalStreaming =
|
|
883
|
+
const messagesEndRef = React3.useRef(null);
|
|
884
|
+
const inputRef = React3.useRef(null);
|
|
885
|
+
const streamingMessageRef = React3.useRef(null);
|
|
886
|
+
const sendToSignalStreaming = React3.useCallback(async (message, context, onToken, onComplete2) => {
|
|
459
887
|
try {
|
|
460
888
|
const response = await fetch(`${signalUrl}/api/skills/setup/chat/stream`, {
|
|
461
889
|
method: "POST",
|
|
@@ -512,7 +940,7 @@ function SetupAssistant({
|
|
|
512
940
|
onComplete2({ actions: result.actions, updated_context: result.updated_context });
|
|
513
941
|
}
|
|
514
942
|
}, [signalUrl, authToken, projectId, orgId]);
|
|
515
|
-
const sendToSignal =
|
|
943
|
+
const sendToSignal = React3.useCallback(async (message, context) => {
|
|
516
944
|
try {
|
|
517
945
|
const response = await fetch(`${signalUrl}/api/skills/setup/chat`, {
|
|
518
946
|
method: "POST",
|
|
@@ -541,7 +969,7 @@ function SetupAssistant({
|
|
|
541
969
|
};
|
|
542
970
|
}
|
|
543
971
|
}, [signalUrl, authToken, projectId, orgId]);
|
|
544
|
-
const extractBrandFromDomain =
|
|
972
|
+
const extractBrandFromDomain = React3.useCallback(async (domain) => {
|
|
545
973
|
setIsExtracting(true);
|
|
546
974
|
try {
|
|
547
975
|
const response = await fetch(`${apiUrl}/site-scrape/brand-only`, {
|
|
@@ -573,7 +1001,7 @@ function SetupAssistant({
|
|
|
573
1001
|
setIsExtracting(false);
|
|
574
1002
|
}
|
|
575
1003
|
}, [apiUrl, authToken]);
|
|
576
|
-
const addMessage =
|
|
1004
|
+
const addMessage = React3.useCallback((message) => {
|
|
577
1005
|
const newMessage = {
|
|
578
1006
|
...message,
|
|
579
1007
|
id: crypto.randomUUID(),
|
|
@@ -582,12 +1010,12 @@ function SetupAssistant({
|
|
|
582
1010
|
setMessages((prev) => [...prev, newMessage]);
|
|
583
1011
|
return newMessage;
|
|
584
1012
|
}, []);
|
|
585
|
-
|
|
1013
|
+
React3.useCallback((id, update) => {
|
|
586
1014
|
setMessages((prev) => prev.map(
|
|
587
1015
|
(m) => m.id === id ? { ...m, ...update } : m
|
|
588
1016
|
));
|
|
589
1017
|
}, []);
|
|
590
|
-
const addStreamingMessage =
|
|
1018
|
+
const addStreamingMessage = React3.useCallback(() => {
|
|
591
1019
|
const id = crypto.randomUUID();
|
|
592
1020
|
const newMessage = {
|
|
593
1021
|
id,
|
|
@@ -600,14 +1028,14 @@ function SetupAssistant({
|
|
|
600
1028
|
streamingMessageRef.current = id;
|
|
601
1029
|
return id;
|
|
602
1030
|
}, []);
|
|
603
|
-
const appendToStreamingMessage =
|
|
1031
|
+
const appendToStreamingMessage = React3.useCallback((token) => {
|
|
604
1032
|
const id = streamingMessageRef.current;
|
|
605
1033
|
if (!id) return;
|
|
606
1034
|
setMessages((prev) => prev.map(
|
|
607
1035
|
(m) => m.id === id ? { ...m, content: m.content + token } : m
|
|
608
1036
|
));
|
|
609
1037
|
}, []);
|
|
610
|
-
const finalizeStreamingMessage =
|
|
1038
|
+
const finalizeStreamingMessage = React3.useCallback((actions) => {
|
|
611
1039
|
const id = streamingMessageRef.current;
|
|
612
1040
|
if (!id) return;
|
|
613
1041
|
setMessages((prev) => prev.map(
|
|
@@ -615,20 +1043,20 @@ function SetupAssistant({
|
|
|
615
1043
|
));
|
|
616
1044
|
streamingMessageRef.current = null;
|
|
617
1045
|
}, []);
|
|
618
|
-
const addAssistantMessage =
|
|
1046
|
+
const addAssistantMessage = React3.useCallback((content, actions, component) => {
|
|
619
1047
|
setIsTyping(true);
|
|
620
1048
|
setTimeout(() => {
|
|
621
1049
|
setIsTyping(false);
|
|
622
1050
|
addMessage({ role: "assistant", content, actions, component });
|
|
623
1051
|
}, 500 + Math.random() * 500);
|
|
624
1052
|
}, [addMessage]);
|
|
625
|
-
const scrollToBottom =
|
|
1053
|
+
const scrollToBottom = React3.useCallback(() => {
|
|
626
1054
|
messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
627
1055
|
}, []);
|
|
628
|
-
|
|
1056
|
+
React3.useEffect(() => {
|
|
629
1057
|
scrollToBottom();
|
|
630
1058
|
}, [messages, isTyping, scrollToBottom]);
|
|
631
|
-
|
|
1059
|
+
React3.useEffect(() => {
|
|
632
1060
|
const welcome = welcomeMessage || `Hey! \u{1F44B} I'm Signal, your AI setup assistant.
|
|
633
1061
|
|
|
634
1062
|
I'll help you integrate Uptrade Site-Kit into your project. What are we working with today?`;
|
|
@@ -640,7 +1068,7 @@ I'll help you integrate Uptrade Site-Kit into your project. What are we working
|
|
|
640
1068
|
]);
|
|
641
1069
|
}, 500);
|
|
642
1070
|
}, []);
|
|
643
|
-
const handleAction =
|
|
1071
|
+
const handleAction = React3.useCallback(async (action, data) => {
|
|
644
1072
|
switch (action) {
|
|
645
1073
|
case "start":
|
|
646
1074
|
addMessage({ role: "user", content: "Let's do it!" });
|
|
@@ -976,7 +1404,7 @@ What's easier?`,
|
|
|
976
1404
|
break;
|
|
977
1405
|
}
|
|
978
1406
|
}, [addMessage, addAssistantMessage, addStreamingMessage, appendToStreamingMessage, finalizeStreamingMessage, sendToSignalStreaming, state, onComplete]);
|
|
979
|
-
const handleAuthSuccess =
|
|
1407
|
+
const handleAuthSuccess = React3.useCallback((email) => {
|
|
980
1408
|
addAssistantMessage(
|
|
981
1409
|
`Welcome back, ${email.split("@")[0]}! \u{1F44B}
|
|
982
1410
|
|
|
@@ -988,7 +1416,7 @@ I found these projects in your account. Which one are we setting up?`,
|
|
|
988
1416
|
]
|
|
989
1417
|
);
|
|
990
1418
|
}, [addAssistantMessage]);
|
|
991
|
-
const verifyIntegration =
|
|
1419
|
+
const verifyIntegration = React3.useCallback(async () => {
|
|
992
1420
|
setState((prev) => ({ ...prev, step: "verify" }));
|
|
993
1421
|
setIsTyping(true);
|
|
994
1422
|
try {
|
|
@@ -1054,7 +1482,7 @@ You can manually verify by:
|
|
|
1054
1482
|
);
|
|
1055
1483
|
}
|
|
1056
1484
|
}, [signalUrl, authToken, projectId, state.context.project_id, addAssistantMessage]);
|
|
1057
|
-
const showModuleSelectionWithRecommendations =
|
|
1485
|
+
const showModuleSelectionWithRecommendations = React3.useCallback(async () => {
|
|
1058
1486
|
const { brand, business_type, scan_results } = state.context;
|
|
1059
1487
|
if (brand || business_type) {
|
|
1060
1488
|
try {
|
|
@@ -1081,7 +1509,7 @@ You can manually verify by:
|
|
|
1081
1509
|
}
|
|
1082
1510
|
showModuleSelection();
|
|
1083
1511
|
}, [state.context, state.selectedModules, sendToSignal, handleAction]);
|
|
1084
|
-
const showModuleSelection =
|
|
1512
|
+
const showModuleSelection = React3.useCallback(() => {
|
|
1085
1513
|
addAssistantMessage(
|
|
1086
1514
|
`Perfect! Now let's choose which features to enable.
|
|
1087
1515
|
|
|
@@ -1098,7 +1526,7 @@ I've pre-selected the essentials, but you can customize:`,
|
|
|
1098
1526
|
)
|
|
1099
1527
|
);
|
|
1100
1528
|
}, [addAssistantMessage, state.selectedModules, handleAction]);
|
|
1101
|
-
const showConfigGeneration =
|
|
1529
|
+
const showConfigGeneration = React3.useCallback(() => {
|
|
1102
1530
|
const code = generateIntegrationCode(state);
|
|
1103
1531
|
addAssistantMessage(
|
|
1104
1532
|
`Here's your integration code! \u{1F389}
|
|
@@ -1110,7 +1538,7 @@ Add this to your root layout:`,
|
|
|
1110
1538
|
/* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code })
|
|
1111
1539
|
);
|
|
1112
1540
|
}, [addAssistantMessage, state]);
|
|
1113
|
-
const handleSubmit =
|
|
1541
|
+
const handleSubmit = React3.useCallback(async (e) => {
|
|
1114
1542
|
e.preventDefault();
|
|
1115
1543
|
if (!input.trim()) return;
|
|
1116
1544
|
const userInput = input.trim();
|
|
@@ -1232,7 +1660,7 @@ Let me help you with that. What would you like to do?`,
|
|
|
1232
1660
|
...styles.bubble,
|
|
1233
1661
|
...message.role === "assistant" ? styles.bubbleAssistant : styles.bubbleUser
|
|
1234
1662
|
},
|
|
1235
|
-
children: message.content.split("\n").map((line, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1663
|
+
children: message.content.split("\n").map((line, i) => /* @__PURE__ */ jsxRuntime.jsxs(React3__default.default.Fragment, { children: [
|
|
1236
1664
|
line,
|
|
1237
1665
|
i < message.content.split("\n").length - 1 && /* @__PURE__ */ jsxRuntime.jsx("br", {})
|
|
1238
1666
|
] }, i))
|
|
@@ -1531,19 +1959,19 @@ function BookingWidget({
|
|
|
1531
1959
|
hideTypeSelector = false,
|
|
1532
1960
|
styles: styles2 = {}
|
|
1533
1961
|
}) {
|
|
1534
|
-
const [step, setStep] =
|
|
1535
|
-
const [loading, setLoading] =
|
|
1536
|
-
const [error, setError] =
|
|
1537
|
-
const [bookingTypes, setBookingTypes] =
|
|
1538
|
-
const [selectedType, setSelectedType] =
|
|
1539
|
-
const [selectedDate, setSelectedDate] =
|
|
1540
|
-
const [slots, setSlots] =
|
|
1541
|
-
const [selectedSlot, setSelectedSlot] =
|
|
1542
|
-
const [hold, setHold] =
|
|
1543
|
-
const [guestInfo, setGuestInfo] =
|
|
1544
|
-
const [bookingResult, setBookingResult] =
|
|
1545
|
-
const timezone =
|
|
1546
|
-
const availableDates =
|
|
1962
|
+
const [step, setStep] = React3.useState(bookingTypeSlug ? "datetime" : "type");
|
|
1963
|
+
const [loading, setLoading] = React3.useState(false);
|
|
1964
|
+
const [error, setError] = React3.useState(null);
|
|
1965
|
+
const [bookingTypes, setBookingTypes] = React3.useState([]);
|
|
1966
|
+
const [selectedType, setSelectedType] = React3.useState(null);
|
|
1967
|
+
const [selectedDate, setSelectedDate] = React3.useState(null);
|
|
1968
|
+
const [slots, setSlots] = React3.useState([]);
|
|
1969
|
+
const [selectedSlot, setSelectedSlot] = React3.useState(null);
|
|
1970
|
+
const [hold, setHold] = React3.useState(null);
|
|
1971
|
+
const [guestInfo, setGuestInfo] = React3.useState({ name: "", email: "" });
|
|
1972
|
+
const [bookingResult, setBookingResult] = React3.useState(null);
|
|
1973
|
+
const timezone = React3.useMemo(() => propTimezone || detectTimezone(), [propTimezone]);
|
|
1974
|
+
const availableDates = React3.useMemo(() => {
|
|
1547
1975
|
const dates = [];
|
|
1548
1976
|
const today = /* @__PURE__ */ new Date();
|
|
1549
1977
|
today.setHours(0, 0, 0, 0);
|
|
@@ -1556,7 +1984,7 @@ function BookingWidget({
|
|
|
1556
1984
|
}
|
|
1557
1985
|
return dates;
|
|
1558
1986
|
}, [daysToShow]);
|
|
1559
|
-
|
|
1987
|
+
React3.useEffect(() => {
|
|
1560
1988
|
if (bookingTypeSlug) {
|
|
1561
1989
|
fetchBookingTypeDetails(orgSlug, bookingTypeSlug, apiUrl).then((type) => {
|
|
1562
1990
|
setSelectedType(type);
|
|
@@ -1572,7 +2000,7 @@ function BookingWidget({
|
|
|
1572
2000
|
});
|
|
1573
2001
|
}
|
|
1574
2002
|
}, [orgSlug, bookingTypeSlug, apiUrl, onError]);
|
|
1575
|
-
|
|
2003
|
+
React3.useEffect(() => {
|
|
1576
2004
|
if (!selectedDate || !selectedType) return;
|
|
1577
2005
|
const dateStr = selectedDate.toISOString().split("T")[0];
|
|
1578
2006
|
setLoading(true);
|
|
@@ -1583,7 +2011,7 @@ function BookingWidget({
|
|
|
1583
2011
|
onError?.(err);
|
|
1584
2012
|
}).finally(() => setLoading(false));
|
|
1585
2013
|
}, [selectedDate, selectedType, orgSlug, apiUrl, timezone, onError]);
|
|
1586
|
-
const handleSlotSelect =
|
|
2014
|
+
const handleSlotSelect = React3.useCallback(async (slot) => {
|
|
1587
2015
|
if (!selectedType) return;
|
|
1588
2016
|
if (hold) {
|
|
1589
2017
|
await releaseSlotHold(hold.holdId, apiUrl).catch(() => {
|
|
@@ -1608,7 +2036,7 @@ function BookingWidget({
|
|
|
1608
2036
|
setLoading(false);
|
|
1609
2037
|
}
|
|
1610
2038
|
}, [selectedType, hold, timezone, apiUrl, onError]);
|
|
1611
|
-
const handleBookingSubmit =
|
|
2039
|
+
const handleBookingSubmit = React3.useCallback(async (e) => {
|
|
1612
2040
|
e.preventDefault();
|
|
1613
2041
|
if (!selectedType || !selectedSlot) return;
|
|
1614
2042
|
setLoading(true);
|
|
@@ -1633,7 +2061,7 @@ function BookingWidget({
|
|
|
1633
2061
|
setLoading(false);
|
|
1634
2062
|
}
|
|
1635
2063
|
}, [selectedType, selectedSlot, guestInfo, timezone, hold, apiUrl, onBookingComplete, onError]);
|
|
1636
|
-
|
|
2064
|
+
React3.useEffect(() => {
|
|
1637
2065
|
return () => {
|
|
1638
2066
|
if (hold) {
|
|
1639
2067
|
releaseSlotHold(hold.holdId, apiUrl).catch(() => {
|
|
@@ -2423,70 +2851,40 @@ Object.defineProperty(exports, "handleManagedRedirects", {
|
|
|
2423
2851
|
});
|
|
2424
2852
|
Object.defineProperty(exports, "ManagedImage", {
|
|
2425
2853
|
enumerable: true,
|
|
2426
|
-
get: function () { return
|
|
2427
|
-
});
|
|
2428
|
-
Object.defineProperty(exports, "SignalBridge", {
|
|
2429
|
-
enumerable: true,
|
|
2430
|
-
get: function () { return chunkTDK7DLCH_js.SignalBridge; }
|
|
2431
|
-
});
|
|
2432
|
-
Object.defineProperty(exports, "SiteKitProvider", {
|
|
2433
|
-
enumerable: true,
|
|
2434
|
-
get: function () { return chunkTDK7DLCH_js.SiteKitProvider; }
|
|
2854
|
+
get: function () { return chunkFLAA4ZJO_js.ManagedImage; }
|
|
2435
2855
|
});
|
|
2436
2856
|
Object.defineProperty(exports, "assignImageToSlot", {
|
|
2437
2857
|
enumerable: true,
|
|
2438
|
-
get: function () { return
|
|
2858
|
+
get: function () { return chunkFLAA4ZJO_js.assignImageToSlot; }
|
|
2439
2859
|
});
|
|
2440
2860
|
Object.defineProperty(exports, "clearImageSlot", {
|
|
2441
2861
|
enumerable: true,
|
|
2442
|
-
get: function () { return
|
|
2862
|
+
get: function () { return chunkFLAA4ZJO_js.clearImageSlot; }
|
|
2443
2863
|
});
|
|
2444
2864
|
Object.defineProperty(exports, "fetchManagedImage", {
|
|
2445
2865
|
enumerable: true,
|
|
2446
|
-
get: function () { return
|
|
2866
|
+
get: function () { return chunkFLAA4ZJO_js.fetchManagedImage; }
|
|
2447
2867
|
});
|
|
2448
2868
|
Object.defineProperty(exports, "fetchManagedImages", {
|
|
2449
2869
|
enumerable: true,
|
|
2450
|
-
get: function () { return
|
|
2870
|
+
get: function () { return chunkFLAA4ZJO_js.fetchManagedImages; }
|
|
2451
2871
|
});
|
|
2452
2872
|
Object.defineProperty(exports, "listImageFiles", {
|
|
2453
2873
|
enumerable: true,
|
|
2454
|
-
get: function () { return
|
|
2874
|
+
get: function () { return chunkFLAA4ZJO_js.listImageFiles; }
|
|
2455
2875
|
});
|
|
2456
2876
|
Object.defineProperty(exports, "uploadImage", {
|
|
2457
2877
|
enumerable: true,
|
|
2458
|
-
get: function () { return
|
|
2459
|
-
});
|
|
2460
|
-
Object.defineProperty(exports, "useSignal", {
|
|
2461
|
-
enumerable: true,
|
|
2462
|
-
get: function () { return chunkTDK7DLCH_js.useSignal; }
|
|
2463
|
-
});
|
|
2464
|
-
Object.defineProperty(exports, "useSignalConfig", {
|
|
2465
|
-
enumerable: true,
|
|
2466
|
-
get: function () { return chunkTDK7DLCH_js.useSignalConfig; }
|
|
2467
|
-
});
|
|
2468
|
-
Object.defineProperty(exports, "useSignalEvent", {
|
|
2469
|
-
enumerable: true,
|
|
2470
|
-
get: function () { return chunkTDK7DLCH_js.useSignalEvent; }
|
|
2471
|
-
});
|
|
2472
|
-
Object.defineProperty(exports, "useSignalExperiment", {
|
|
2473
|
-
enumerable: true,
|
|
2474
|
-
get: function () { return chunkTDK7DLCH_js.useSignalExperiment; }
|
|
2475
|
-
});
|
|
2476
|
-
Object.defineProperty(exports, "useSignalOutcome", {
|
|
2477
|
-
enumerable: true,
|
|
2478
|
-
get: function () { return chunkTDK7DLCH_js.useSignalOutcome; }
|
|
2479
|
-
});
|
|
2480
|
-
Object.defineProperty(exports, "useSiteKit", {
|
|
2481
|
-
enumerable: true,
|
|
2482
|
-
get: function () { return chunkTDK7DLCH_js.useSiteKit; }
|
|
2878
|
+
get: function () { return chunkFLAA4ZJO_js.uploadImage; }
|
|
2483
2879
|
});
|
|
2484
2880
|
exports.AffiliateCard = AffiliateCard;
|
|
2485
2881
|
exports.AffiliatesWidget = AffiliatesWidget;
|
|
2486
2882
|
exports.BookingWidget = BookingWidget;
|
|
2487
2883
|
exports.ExperimentConversion = ExperimentConversion;
|
|
2488
2884
|
exports.SetupAssistant = SetupAssistant;
|
|
2885
|
+
exports.SignalBridge = SignalBridge;
|
|
2489
2886
|
exports.SignalExperiment = SignalExperiment;
|
|
2887
|
+
exports.SiteKitProvider = SiteKitProvider;
|
|
2490
2888
|
exports.createBooking = createBooking;
|
|
2491
2889
|
exports.createSlotHold = createSlotHold;
|
|
2492
2890
|
exports.detectTimezone = detectTimezone;
|
|
@@ -2502,5 +2900,11 @@ exports.getTrackingUrl = getTrackingUrl;
|
|
|
2502
2900
|
exports.releaseSlotHold = releaseSlotHold;
|
|
2503
2901
|
exports.useAffiliates = useAffiliates;
|
|
2504
2902
|
exports.useExperimentVariant = useExperimentVariant;
|
|
2903
|
+
exports.useSignal = useSignal;
|
|
2904
|
+
exports.useSignalConfig = useSignalConfig;
|
|
2905
|
+
exports.useSignalEvent = useSignalEvent;
|
|
2906
|
+
exports.useSignalExperiment = useSignalExperiment;
|
|
2907
|
+
exports.useSignalOutcome = useSignalOutcome;
|
|
2908
|
+
exports.useSiteKit = useSiteKit;
|
|
2505
2909
|
//# sourceMappingURL=index.js.map
|
|
2506
2910
|
//# sourceMappingURL=index.js.map
|