@gurulu/web 1.1.0 → 1.2.0
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/activate-runtime.d.ts +15 -0
- package/dist/activate-runtime.d.ts.map +1 -0
- package/dist/activate-runtime.js +237 -0
- package/dist/activation.d.ts +106 -0
- package/dist/activation.d.ts.map +1 -0
- package/dist/autocapture/error.d.ts +14 -0
- package/dist/autocapture/error.d.ts.map +1 -0
- package/dist/autocapture/index.d.ts +2 -0
- package/dist/autocapture/index.d.ts.map +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +182 -1
- package/dist/react.js +181 -1
- package/dist/t.js +7 -7
- package/dist/t.js.map +8 -6
- package/package.json +7 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GuruluActivation } from './activation.ts';
|
|
2
|
+
interface ActivationHost {
|
|
3
|
+
activation: GuruluActivation;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Hosted Activation render — refresh + tüm aktif öğeleri çizer. Tour/personalize/
|
|
7
|
+
* popup. Opsiyon: `{ popups, tours, personalization }` ile seçici kapatma.
|
|
8
|
+
*/
|
|
9
|
+
export declare function runActivation(sdk: ActivationHost, opts?: {
|
|
10
|
+
popups?: boolean;
|
|
11
|
+
tours?: boolean;
|
|
12
|
+
personalization?: boolean;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=activate-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate-runtime.d.ts","sourceRoot":"","sources":["../src/activate-runtime.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,iBAAiB,CAAC;AAE3E,UAAU,cAAc;IACtB,UAAU,EAAE,gBAAgB,CAAC;CAC9B;AAoOD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,cAAc,EACnB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GACtE,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// src/activate-runtime.ts
|
|
2
|
+
var STYLE = `
|
|
3
|
+
:host { all: initial; }
|
|
4
|
+
.gurulu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2147483000;
|
|
5
|
+
display: flex; align-items: center; justify-content: center; font-family: system-ui, sans-serif; }
|
|
6
|
+
.gurulu-card { max-width: 420px; width: calc(100% - 32px); border-radius: 10px; padding: 22px;
|
|
7
|
+
box-shadow: 0 12px 40px rgba(0,0,0,.25); position: relative; }
|
|
8
|
+
.gurulu-banner { position: fixed; left: 0; right: 0; z-index: 2147483000; padding: 14px 18px;
|
|
9
|
+
font-family: system-ui, sans-serif; box-shadow: 0 2px 12px rgba(0,0,0,.15);
|
|
10
|
+
display: flex; align-items: center; gap: 14px; justify-content: center; }
|
|
11
|
+
.gurulu-slidein { position: fixed; bottom: 20px; right: 20px; max-width: 340px; z-index: 2147483000;
|
|
12
|
+
border-radius: 10px; padding: 18px; box-shadow: 0 10px 32px rgba(0,0,0,.25); font-family: system-ui, sans-serif; }
|
|
13
|
+
.gurulu-title { font-size: 17px; font-weight: 700; margin: 0 0 6px; }
|
|
14
|
+
.gurulu-body { font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
|
|
15
|
+
.gurulu-body img { max-width: 100%; }
|
|
16
|
+
.gurulu-cta { display: inline-block; padding: 9px 16px; border-radius: 7px; border: none;
|
|
17
|
+
font-size: 14px; font-weight: 600; color: #fff; cursor: pointer; text-decoration: none; }
|
|
18
|
+
.gurulu-img { width: 100%; max-height: 140px; object-fit: cover; border-radius: 7px; margin-bottom: 12px; }
|
|
19
|
+
.gurulu-close { position: absolute; top: 8px; right: 10px; background: none; border: none;
|
|
20
|
+
font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
|
|
21
|
+
.gurulu-tour-spot { position: fixed; z-index: 2147483000; border: 2px solid var(--accent,#2563eb);
|
|
22
|
+
border-radius: 6px; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); pointer-events: none; transition: all .2s; }
|
|
23
|
+
.gurulu-tip { position: fixed; z-index: 2147483001; max-width: 280px; background: #fff; color: #111;
|
|
24
|
+
border-radius: 8px; padding: 14px; box-shadow: 0 8px 28px rgba(0,0,0,.25); font-family: system-ui, sans-serif; }
|
|
25
|
+
.gurulu-tip-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
|
|
26
|
+
`;
|
|
27
|
+
function shadowHost() {
|
|
28
|
+
const host = document.createElement("div");
|
|
29
|
+
host.setAttribute("data-gurulu-activation", "");
|
|
30
|
+
document.body.appendChild(host);
|
|
31
|
+
const root = host.attachShadow({ mode: "open" });
|
|
32
|
+
const style = document.createElement("style");
|
|
33
|
+
style.textContent = STYLE;
|
|
34
|
+
root.appendChild(style);
|
|
35
|
+
return root;
|
|
36
|
+
}
|
|
37
|
+
function freqKey(key) {
|
|
38
|
+
const day = new Date().toISOString().slice(0, 10);
|
|
39
|
+
return `gurulu_popup_${key}_${day}`;
|
|
40
|
+
}
|
|
41
|
+
function underCap(p) {
|
|
42
|
+
const cap = p.frequency_cap?.per_user_per_day;
|
|
43
|
+
if (!cap || cap <= 0)
|
|
44
|
+
return true;
|
|
45
|
+
try {
|
|
46
|
+
const n = Number.parseInt(localStorage.getItem(freqKey(p.key)) ?? "0", 10) || 0;
|
|
47
|
+
return n < cap;
|
|
48
|
+
} catch {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function bumpCap(key) {
|
|
53
|
+
try {
|
|
54
|
+
const k = freqKey(key);
|
|
55
|
+
const n = Number.parseInt(localStorage.getItem(k) ?? "0", 10) || 0;
|
|
56
|
+
localStorage.setItem(k, String(n + 1));
|
|
57
|
+
} catch {}
|
|
58
|
+
}
|
|
59
|
+
function renderPopup(act, p) {
|
|
60
|
+
if (!underCap(p))
|
|
61
|
+
return;
|
|
62
|
+
const root = shadowHost();
|
|
63
|
+
const c = p.content;
|
|
64
|
+
const bg = c.bg_color || "#ffffff";
|
|
65
|
+
const text = c.text_color || "#111111";
|
|
66
|
+
const accent = c.accent_color || "#2563eb";
|
|
67
|
+
const inner = document.createElement("div");
|
|
68
|
+
inner.style.background = bg;
|
|
69
|
+
inner.style.color = text;
|
|
70
|
+
inner.innerHTML = `
|
|
71
|
+
<button class="gurulu-close" aria-label="close">×</button>
|
|
72
|
+
${c.image_url ? `<img class="gurulu-img" src="${c.image_url}" alt="">` : ""}
|
|
73
|
+
${c.title ? `<div class="gurulu-title">${escapeText(c.title)}</div>` : ""}
|
|
74
|
+
${c.body_html ? `<div class="gurulu-body">${c.body_html}</div>` : ""}
|
|
75
|
+
${c.cta_label ? `<a class="gurulu-cta" style="background:${accent}" href="${c.cta_url || "#"}" target="_blank" rel="noopener">${escapeText(c.cta_label)}</a>` : ""}
|
|
76
|
+
`;
|
|
77
|
+
let container;
|
|
78
|
+
if (p.type === "banner") {
|
|
79
|
+
inner.className = "gurulu-banner";
|
|
80
|
+
inner.style.top = "0";
|
|
81
|
+
container = inner;
|
|
82
|
+
} else if (p.type === "slidein") {
|
|
83
|
+
inner.className = "gurulu-slidein";
|
|
84
|
+
container = inner;
|
|
85
|
+
} else {
|
|
86
|
+
const overlay = document.createElement("div");
|
|
87
|
+
overlay.className = "gurulu-overlay";
|
|
88
|
+
inner.className = "gurulu-card";
|
|
89
|
+
overlay.appendChild(inner);
|
|
90
|
+
overlay.addEventListener("click", (e) => {
|
|
91
|
+
if (e.target === overlay)
|
|
92
|
+
dismiss();
|
|
93
|
+
});
|
|
94
|
+
container = overlay;
|
|
95
|
+
}
|
|
96
|
+
root.appendChild(container);
|
|
97
|
+
bumpCap(p.key);
|
|
98
|
+
act.trackPopup(p.key, "shown");
|
|
99
|
+
function teardown() {
|
|
100
|
+
const hostEl = root.host;
|
|
101
|
+
hostEl.remove();
|
|
102
|
+
}
|
|
103
|
+
function dismiss() {
|
|
104
|
+
act.trackPopup(p.key, "dismissed");
|
|
105
|
+
teardown();
|
|
106
|
+
}
|
|
107
|
+
inner.querySelector(".gurulu-close")?.addEventListener("click", dismiss);
|
|
108
|
+
inner.querySelector(".gurulu-cta")?.addEventListener("click", () => {
|
|
109
|
+
act.trackPopup(p.key, "clicked");
|
|
110
|
+
teardown();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function setupPopupTrigger(act, p) {
|
|
114
|
+
const t = p.trigger ?? { type: "load" };
|
|
115
|
+
const fire = () => renderPopup(act, p);
|
|
116
|
+
if (t.type === "load") {
|
|
117
|
+
fire();
|
|
118
|
+
} else if (t.type === "delay") {
|
|
119
|
+
setTimeout(fire, Math.min(Math.max(t.value ?? 3000, 0), 600000));
|
|
120
|
+
} else if (t.type === "scroll") {
|
|
121
|
+
const pct = (t.value ?? 50) / 100;
|
|
122
|
+
const onScroll = () => {
|
|
123
|
+
const sc = window.scrollY / (document.body.scrollHeight - window.innerHeight || 1);
|
|
124
|
+
if (sc >= pct) {
|
|
125
|
+
window.removeEventListener("scroll", onScroll);
|
|
126
|
+
fire();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
window.addEventListener("scroll", onScroll, { passive: true });
|
|
130
|
+
} else if (t.type === "exit_intent") {
|
|
131
|
+
const onLeave = (e) => {
|
|
132
|
+
if (e.clientY <= 0) {
|
|
133
|
+
document.removeEventListener("mouseout", onLeave);
|
|
134
|
+
fire();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
document.addEventListener("mouseout", onLeave);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function applyPersonalization(act) {
|
|
141
|
+
const slots = document.querySelectorAll("[data-gurulu-slot]");
|
|
142
|
+
slots.forEach((el) => {
|
|
143
|
+
const slot = el.getAttribute("data-gurulu-slot");
|
|
144
|
+
if (!slot)
|
|
145
|
+
return;
|
|
146
|
+
const content = act.getContent(slot);
|
|
147
|
+
if (!content)
|
|
148
|
+
return;
|
|
149
|
+
if (content.html)
|
|
150
|
+
el.innerHTML = content.html;
|
|
151
|
+
else if (content.text)
|
|
152
|
+
el.textContent = content.text;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function runTour(act, tour) {
|
|
156
|
+
if (!tour.steps || tour.steps.length === 0)
|
|
157
|
+
return;
|
|
158
|
+
const root = shadowHost();
|
|
159
|
+
let idx = tour.progress?.current_step ?? 0;
|
|
160
|
+
if (idx >= tour.steps.length)
|
|
161
|
+
idx = 0;
|
|
162
|
+
act.trackTour(tour.key, "started", idx);
|
|
163
|
+
const spot = document.createElement("div");
|
|
164
|
+
spot.className = "gurulu-tour-spot";
|
|
165
|
+
const tip = document.createElement("div");
|
|
166
|
+
tip.className = "gurulu-tip";
|
|
167
|
+
root.appendChild(spot);
|
|
168
|
+
root.appendChild(tip);
|
|
169
|
+
function teardown() {
|
|
170
|
+
root.host.remove();
|
|
171
|
+
}
|
|
172
|
+
function render() {
|
|
173
|
+
const step = tour.steps[idx];
|
|
174
|
+
if (!step)
|
|
175
|
+
return;
|
|
176
|
+
const target = document.querySelector(step.selector);
|
|
177
|
+
if (!target) {
|
|
178
|
+
next(true);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const r = target.getBoundingClientRect();
|
|
182
|
+
spot.style.left = `${r.left - 4}px`;
|
|
183
|
+
spot.style.top = `${r.top - 4}px`;
|
|
184
|
+
spot.style.width = `${r.width + 8}px`;
|
|
185
|
+
spot.style.height = `${r.height + 8}px`;
|
|
186
|
+
tip.style.left = `${Math.min(r.left, window.innerWidth - 300)}px`;
|
|
187
|
+
tip.style.top = `${r.bottom + 12}px`;
|
|
188
|
+
tip.innerHTML = `
|
|
189
|
+
<div style="font-weight:700;margin-bottom:5px">${escapeText(step.title)}</div>
|
|
190
|
+
<div style="font-size:13px;line-height:1.4">${escapeText(step.body)}</div>
|
|
191
|
+
<div class="gurulu-tip-btns">
|
|
192
|
+
<button data-act="skip" style="background:none;border:none;cursor:pointer;color:#888">Skip</button>
|
|
193
|
+
<button data-act="next" style="background:#2563eb;color:#fff;border:none;border-radius:6px;padding:6px 12px;cursor:pointer">
|
|
194
|
+
${idx + 1 >= tour.steps.length ? "Done" : "Next"}</button>
|
|
195
|
+
</div>`;
|
|
196
|
+
tip.querySelector('[data-act="next"]')?.addEventListener("click", () => next(false));
|
|
197
|
+
tip.querySelector('[data-act="skip"]')?.addEventListener("click", () => {
|
|
198
|
+
act.trackTour(tour.key, "dismissed", idx);
|
|
199
|
+
teardown();
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function next(autoSkip) {
|
|
203
|
+
if (!autoSkip)
|
|
204
|
+
act.trackTour(tour.key, "step_completed", idx);
|
|
205
|
+
idx += 1;
|
|
206
|
+
if (idx >= tour.steps.length) {
|
|
207
|
+
act.trackTour(tour.key, "completed", tour.steps.length - 1);
|
|
208
|
+
teardown();
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
render();
|
|
212
|
+
}
|
|
213
|
+
render();
|
|
214
|
+
}
|
|
215
|
+
function escapeText(s) {
|
|
216
|
+
return s.replace(/[&<>"]/g, (ch) => ch === "&" ? "&" : ch === "<" ? "<" : ch === ">" ? ">" : """);
|
|
217
|
+
}
|
|
218
|
+
async function runActivation(sdk, opts) {
|
|
219
|
+
if (typeof document === "undefined")
|
|
220
|
+
return;
|
|
221
|
+
const act = sdk.activation;
|
|
222
|
+
await act.refresh();
|
|
223
|
+
if (opts?.personalization !== false)
|
|
224
|
+
applyPersonalization(act);
|
|
225
|
+
if (opts?.popups !== false) {
|
|
226
|
+
for (const p of act.getPopups())
|
|
227
|
+
setupPopupTrigger(act, p);
|
|
228
|
+
}
|
|
229
|
+
if (opts?.tours !== false) {
|
|
230
|
+
const tour = act.getTours().find((t) => t.trigger?.auto !== false);
|
|
231
|
+
if (tour)
|
|
232
|
+
runTour(act, tour);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
export {
|
|
236
|
+
runActivation
|
|
237
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export declare function fnv1a32(str: string): number;
|
|
2
|
+
export declare function activationBucket(key: string, uid: string): number;
|
|
3
|
+
export interface PopupDef {
|
|
4
|
+
key: string;
|
|
5
|
+
type: 'modal' | 'banner' | 'slidein';
|
|
6
|
+
content: Record<string, string>;
|
|
7
|
+
trigger: {
|
|
8
|
+
type: string;
|
|
9
|
+
value?: number;
|
|
10
|
+
};
|
|
11
|
+
frequency_cap?: {
|
|
12
|
+
per_user_per_day?: number;
|
|
13
|
+
};
|
|
14
|
+
consent_category?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TourStepDef {
|
|
17
|
+
selector: string;
|
|
18
|
+
title: string;
|
|
19
|
+
body: string;
|
|
20
|
+
placement?: string;
|
|
21
|
+
advance_on?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface TourDef {
|
|
24
|
+
key: string;
|
|
25
|
+
steps: TourStepDef[];
|
|
26
|
+
trigger: {
|
|
27
|
+
auto?: boolean;
|
|
28
|
+
manual?: boolean;
|
|
29
|
+
};
|
|
30
|
+
progress?: {
|
|
31
|
+
current_step: number;
|
|
32
|
+
completed: boolean;
|
|
33
|
+
dismissed: boolean;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface PznResolved {
|
|
37
|
+
key: string;
|
|
38
|
+
slot_key: string;
|
|
39
|
+
variant_key: string;
|
|
40
|
+
is_holdout: boolean;
|
|
41
|
+
content: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
export interface ExperimentDef {
|
|
44
|
+
key: string;
|
|
45
|
+
variants: Array<{
|
|
46
|
+
key: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
weight: number;
|
|
49
|
+
}>;
|
|
50
|
+
assigned_variant?: string | null;
|
|
51
|
+
}
|
|
52
|
+
export interface ActivationData {
|
|
53
|
+
workspace_id: string;
|
|
54
|
+
popups: PopupDef[];
|
|
55
|
+
tours: TourDef[];
|
|
56
|
+
personalizations: PznResolved[];
|
|
57
|
+
experiments: ExperimentDef[];
|
|
58
|
+
}
|
|
59
|
+
export interface ActivationConfig {
|
|
60
|
+
endpoint: string;
|
|
61
|
+
workspaceKey: string;
|
|
62
|
+
/** person_id ?? anonymous_id. */
|
|
63
|
+
getUid: () => string;
|
|
64
|
+
/** Parent SDK track() — exposure/serve event'leri buradan gider. */
|
|
65
|
+
track: (eventKey: string, properties: Record<string, unknown>) => void;
|
|
66
|
+
fetchImpl?: typeof fetch;
|
|
67
|
+
}
|
|
68
|
+
export declare class GuruluActivation {
|
|
69
|
+
private cfg;
|
|
70
|
+
private data;
|
|
71
|
+
private pending;
|
|
72
|
+
private exposed;
|
|
73
|
+
private served;
|
|
74
|
+
constructor(cfg: ActivationConfig);
|
|
75
|
+
/** /v1/activate'ten aktif config'i çek (tek round-trip). Idempotent (in-flight paylaşır). */
|
|
76
|
+
refresh(opts?: {
|
|
77
|
+
url?: string;
|
|
78
|
+
device?: string;
|
|
79
|
+
}): Promise<ActivationData>;
|
|
80
|
+
/** Eligible popup'lar (refresh çağrılmadıysa boş). */
|
|
81
|
+
getPopups(): PopupDef[];
|
|
82
|
+
/** Aktif tour'lar (uid progress dahil, tamamlanan/kapatılan hariç). */
|
|
83
|
+
getTours(): TourDef[];
|
|
84
|
+
/**
|
|
85
|
+
* Slot için çözülmüş içerik (audience/holdout server'da uygulandı). İlk okumada
|
|
86
|
+
* `personalization_served` emit (bir kez). Slot yoksa null.
|
|
87
|
+
*/
|
|
88
|
+
getContent(slot: string): Record<string, string> | null;
|
|
89
|
+
/**
|
|
90
|
+
* Experiment varyantı (server-assigned; yoksa lokal deterministik). İlk okumada
|
|
91
|
+
* `experiment_exposed` emit (bir kez). Experiment yoksa null.
|
|
92
|
+
*/
|
|
93
|
+
getVariant(experimentKey: string): string | null;
|
|
94
|
+
trackPopup(key: string, action: 'shown' | 'clicked' | 'dismissed'): void;
|
|
95
|
+
trackTour(key: string, action: 'started' | 'step_completed' | 'completed' | 'dismissed', stepIndex?: number): void;
|
|
96
|
+
/** Tur ilerlemesini server'a kaydet (cross-device). Best-effort. */
|
|
97
|
+
saveTourProgress(tourKey: string, body: {
|
|
98
|
+
current_step?: number;
|
|
99
|
+
completed_step?: number;
|
|
100
|
+
completed?: boolean;
|
|
101
|
+
dismissed?: boolean;
|
|
102
|
+
}): Promise<void>;
|
|
103
|
+
/** Test/SSR için snapshot. */
|
|
104
|
+
snapshot(): ActivationData;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=activation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activation.d.ts","sourceRoot":"","sources":["../src/activation.ts"],"names":[],"mappings":"AAQA,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO3C;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjE;AAGD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,aAAa,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AACD,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,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C,EAAE,OAAO,CAAC;QACpB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GACA,OAAO,CAAC,IAAI,CAAC;IAQhB,8BAA8B;IAC9B,QAAQ,IAAI,cAAc;CAG3B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface JsErrorPayload {
|
|
2
|
+
message: string;
|
|
3
|
+
error_type: string;
|
|
4
|
+
source?: string;
|
|
5
|
+
lineno?: number;
|
|
6
|
+
colno?: number;
|
|
7
|
+
stack?: string;
|
|
8
|
+
}
|
|
9
|
+
export type JsErrorTracker = (payload: JsErrorPayload) => void;
|
|
10
|
+
export interface ErrorAutocaptureHandle {
|
|
11
|
+
stop(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function startErrorAutocapture(track: JsErrorTracker): ErrorAutocaptureHandle;
|
|
14
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/autocapture/error.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;AAE/D,MAAM,WAAW,sBAAsB;IACrC,IAAI,IAAI,IAAI,CAAC;CACd;AAKD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,GAAG,sBAAsB,CAkCnF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AutocaptureConfig } from '../types.ts';
|
|
2
2
|
import { type ClickPayload } from './click.ts';
|
|
3
|
+
import { type JsErrorPayload } from './error.ts';
|
|
3
4
|
import { type FormStartedPayload, type FormSubmittedPayload } from './form.ts';
|
|
4
5
|
import { type ScrollDepthPayload } from './scroll.ts';
|
|
5
6
|
import { type WebVitalPayload } from './web-vitals.ts';
|
|
@@ -10,6 +11,7 @@ export interface AutocaptureSinks {
|
|
|
10
11
|
formSubmitted: (payload: FormSubmittedPayload) => void;
|
|
11
12
|
scrollDepth: (payload: ScrollDepthPayload) => void;
|
|
12
13
|
webVital: (payload: WebVitalPayload) => void;
|
|
14
|
+
jsError: (payload: JsErrorPayload) => void;
|
|
13
15
|
}
|
|
14
16
|
export interface AutocaptureHandle {
|
|
15
17
|
stopAll(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autocapture/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,EAAyB,MAAM,YAAY,CAAC;AACtE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAE1B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAC9E,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACvC,WAAW,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,aAAa,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACvD,WAAW,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KA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Activation } from './activation.ts';
|
|
1
2
|
import { GuruluConsent } from './consent.ts';
|
|
2
3
|
import type { InitOptions } from './types.ts';
|
|
3
4
|
export interface PageOverride {
|
|
@@ -14,6 +15,8 @@ export declare class Gurulu {
|
|
|
14
15
|
private autocaptureHandle;
|
|
15
16
|
private testMode;
|
|
16
17
|
consent: GuruluConsent;
|
|
18
|
+
/** M31/M32/M33/M30 Activation — headless (refresh/getPopups/getContent/getVariant). */
|
|
19
|
+
activation: GuruluActivation;
|
|
17
20
|
/**
|
|
18
21
|
* 1-line init. Idempotent — second call no-ops with debug warning.
|
|
19
22
|
*/
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAiB7C,OAAO,KAAK,EAIV,WAAW,EAEZ,MAAM,YAAY,CAAC;AA8BpB,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,IAAI,CAA4B;IACxC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,iBAAiB,CAAwC;IACjE,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,EAAG,aAAa,CAAC;IACxB,uFAAuF;IACvF,UAAU,EAAG,gBAAgB,CAAC;IAE9B;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAyF7B,sEAAsE;IACtE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAInE,gEAAgE;IAChE,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI;IAQnC;;;OAGG;IACG,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BjF,mEAAmE;IACnE,KAAK,IAAI,IAAI;IAeb,uCAAuC;IACjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,8DAA8D;IAC9D,MAAM,IAAI,IAAI;IAId,0BAA0B;IAC1B,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,UAAU;IAkClB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,YAAY;CAcrB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const VERSION = "0.1.0";
|
|
2
|
+
export { type ActivationData, type ExperimentDef, GuruluActivation, type PopupDef, type PznResolved, type TourDef, type TourStepDef, } from './activation.ts';
|
|
2
3
|
export { type BannerConfig, type BannerConfigResponse, type ConsentCategories, type ConsentSnapshot, GuruluConsent, type GuruluConsentOptions, } from './consent.ts';
|
|
3
4
|
export { Gurulu, type PageOverride } from './core.ts';
|
|
4
5
|
export { ConsentBlockedError, InitError, NetworkError, OptedOutError, QueueFullError, SDKError, } from './errors.ts';
|
|
@@ -15,6 +16,8 @@ export interface GuruluPublicSDK {
|
|
|
15
16
|
optOut: () => void;
|
|
16
17
|
optIn: () => void;
|
|
17
18
|
consent: Gurulu['consent'];
|
|
19
|
+
/** M31/M32/M33/M30 Activation headless layer (init sonrası). */
|
|
20
|
+
activation: Gurulu['activation'];
|
|
18
21
|
VERSION: string;
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
@@ -33,6 +36,7 @@ declare const publicSdk: {
|
|
|
33
36
|
optOut: () => void;
|
|
34
37
|
optIn: () => void;
|
|
35
38
|
readonly consent: import("./consent.ts").GuruluConsent;
|
|
39
|
+
readonly activation: import("./activation.ts").GuruluActivation;
|
|
36
40
|
VERSION: string;
|
|
37
41
|
};
|
|
38
42
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,aAAa,EACb,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,aAAa,EACb,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,SA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