@absmartly/sdk-plugins 1.1.2 → 1.2.2
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/absmartly-cookie.min.js +1 -1
- package/dist/absmartly-dom-changes-core.min.js +1 -1
- package/dist/absmartly-dom-changes-lite.min.js +1 -1
- package/dist/absmartly-overrides-full.min.js +1 -1
- package/dist/absmartly-overrides-lite.min.js +1 -1
- package/dist/absmartly-sdk-plugins.min.js +1 -1
- package/dist/absmartly-vitals.min.js +1 -1
- package/es/cookies/cookieUtils.js +2 -1
- package/es/cookies/cookieUtils.js.map +1 -1
- package/es/core/DOMChangesPluginLite.js +195 -221
- package/es/core/DOMChangesPluginLite.js.map +1 -1
- package/es/core/DOMManipulatorLite.js +76 -10
- package/es/core/DOMManipulatorLite.js.map +1 -1
- package/es/core/ExposureTracker.js +136 -11
- package/es/core/ExposureTracker.js.map +1 -1
- package/es/core/PendingChangeManager.js +14 -14
- package/es/core/PendingChangeManager.js.map +1 -1
- package/es/entries/dom-with-overrides-lite.js +3 -0
- package/es/entries/dom-with-overrides-lite.js.map +1 -1
- package/es/generated/buildInfo.js +3 -0
- package/es/generated/buildInfo.js.map +1 -0
- package/es/index.js +9 -2
- package/es/index.js.map +1 -1
- package/es/overrides/OverridesPlugin.js +2 -2
- package/es/overrides/OverridesPlugin.js.map +1 -1
- package/es/overrides/OverridesPluginLite.js +29 -1
- package/es/overrides/OverridesPluginLite.js.map +1 -1
- package/es/overrides/overridesUtils.js +27 -18
- package/es/overrides/overridesUtils.js.map +1 -1
- package/es/parsers/VariantExtractor.js +14 -7
- package/es/parsers/VariantExtractor.js.map +1 -1
- package/es/url-redirect/URLRedirectExtractor.js +185 -0
- package/es/url-redirect/URLRedirectExtractor.js.map +1 -0
- package/es/url-redirect/URLRedirectMatcher.js +116 -0
- package/es/url-redirect/URLRedirectMatcher.js.map +1 -0
- package/es/url-redirect/URLRedirectPlugin.js +351 -0
- package/es/url-redirect/URLRedirectPlugin.js.map +1 -0
- package/es/url-redirect/index.js +5 -0
- package/es/url-redirect/index.js.map +1 -0
- package/es/url-redirect/types.js +2 -0
- package/es/url-redirect/types.js.map +1 -0
- package/es/utils/URLMatcher.js +4 -3
- package/es/utils/URLMatcher.js.map +1 -1
- package/es/utils/debug.js +4 -3
- package/es/utils/debug.js.map +1 -1
- package/es/utils/persistence.js +278 -0
- package/es/utils/persistence.js.map +1 -0
- package/es/utils/plugin-registry.js +47 -0
- package/es/utils/plugin-registry.js.map +1 -0
- package/lib/cookies/cookieUtils.d.ts +0 -4
- package/lib/cookies/cookieUtils.js +6 -5
- package/lib/cookies/cookieUtils.js.map +1 -1
- package/lib/core/DOMChangesPluginLite.d.ts +10 -7
- package/lib/core/DOMChangesPluginLite.js +195 -221
- package/lib/core/DOMChangesPluginLite.js.map +1 -1
- package/lib/core/DOMManipulatorLite.js +76 -10
- package/lib/core/DOMManipulatorLite.js.map +1 -1
- package/lib/core/ExposureTracker.d.ts +6 -0
- package/lib/core/ExposureTracker.js +136 -11
- package/lib/core/ExposureTracker.js.map +1 -1
- package/lib/core/PendingChangeManager.d.ts +0 -1
- package/lib/core/PendingChangeManager.js +14 -14
- package/lib/core/PendingChangeManager.js.map +1 -1
- package/lib/entries/dom-with-overrides-lite.d.ts +2 -0
- package/lib/entries/dom-with-overrides-lite.js +3 -1
- package/lib/entries/dom-with-overrides-lite.js.map +1 -1
- package/lib/generated/buildInfo.d.ts +2 -0
- package/lib/generated/buildInfo.js +6 -0
- package/lib/generated/buildInfo.js.map +1 -0
- package/lib/index.d.ts +8 -2
- package/lib/index.js +17 -1
- package/lib/index.js.map +1 -1
- package/lib/overrides/OverridesPlugin.js +2 -2
- package/lib/overrides/OverridesPlugin.js.map +1 -1
- package/lib/overrides/OverridesPluginLite.d.ts +8 -0
- package/lib/overrides/OverridesPluginLite.js +29 -1
- package/lib/overrides/OverridesPluginLite.js.map +1 -1
- package/lib/overrides/overridesUtils.d.ts +10 -5
- package/lib/overrides/overridesUtils.js +28 -18
- package/lib/overrides/overridesUtils.js.map +1 -1
- package/lib/parsers/VariantExtractor.js +14 -7
- package/lib/parsers/VariantExtractor.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/url-redirect/URLRedirectExtractor.d.ts +16 -0
- package/lib/url-redirect/URLRedirectExtractor.js +188 -0
- package/lib/url-redirect/URLRedirectExtractor.js.map +1 -0
- package/lib/url-redirect/URLRedirectMatcher.d.ts +8 -0
- package/lib/url-redirect/URLRedirectMatcher.js +119 -0
- package/lib/url-redirect/URLRedirectMatcher.js.map +1 -0
- package/lib/url-redirect/URLRedirectPlugin.d.ts +21 -0
- package/lib/url-redirect/URLRedirectPlugin.js +354 -0
- package/lib/url-redirect/URLRedirectPlugin.js.map +1 -0
- package/lib/url-redirect/index.d.ts +4 -0
- package/lib/url-redirect/index.js +25 -0
- package/lib/url-redirect/index.js.map +1 -0
- package/lib/url-redirect/types.d.ts +29 -0
- package/lib/url-redirect/types.js +3 -0
- package/lib/url-redirect/types.js.map +1 -0
- package/lib/utils/URLMatcher.js +4 -3
- package/lib/utils/URLMatcher.js.map +1 -1
- package/lib/utils/debug.d.ts +1 -1
- package/lib/utils/debug.js +4 -3
- package/lib/utils/debug.js.map +1 -1
- package/lib/utils/persistence.d.ts +23 -0
- package/lib/utils/persistence.js +281 -0
- package/lib/utils/persistence.js.map +1 -0
- package/lib/utils/plugin-registry.d.ts +40 -0
- package/lib/utils/plugin-registry.js +53 -0
- package/lib/utils/plugin-registry.js.map +1 -0
- package/package.json +64 -6
- package/types/cookies/cookieUtils.d.ts +0 -4
- package/types/core/DOMChangesPluginLite.d.ts +10 -7
- package/types/core/ExposureTracker.d.ts +6 -0
- package/types/core/PendingChangeManager.d.ts +0 -1
- package/types/entries/dom-with-overrides-lite.d.ts +2 -0
- package/types/generated/buildInfo.d.ts +2 -0
- package/types/index.d.ts +8 -2
- package/types/overrides/OverridesPluginLite.d.ts +8 -0
- package/types/overrides/overridesUtils.d.ts +10 -5
- package/types/types/index.d.ts +1 -0
- package/types/url-redirect/URLRedirectExtractor.d.ts +16 -0
- package/types/url-redirect/URLRedirectMatcher.d.ts +8 -0
- package/types/url-redirect/URLRedirectPlugin.d.ts +21 -0
- package/types/url-redirect/index.d.ts +4 -0
- package/types/url-redirect/types.d.ts +29 -0
- package/types/utils/debug.d.ts +1 -1
- package/types/utils/persistence.d.ts +23 -0
- package/types/utils/plugin-registry.d.ts +40 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.DOMPersistenceManager = void 0;
|
|
31
|
+
var debug_1 = require("./debug");
|
|
32
|
+
var DOMPersistenceManager = /** @class */ (function () {
|
|
33
|
+
function DOMPersistenceManager(config) {
|
|
34
|
+
this.watchedElements = new WeakMap();
|
|
35
|
+
this.persistenceObserver = null;
|
|
36
|
+
this.reapplyingElements = new Set();
|
|
37
|
+
this.reapplyLogThrottle = new Map();
|
|
38
|
+
this.appliedChanges = new Map();
|
|
39
|
+
this.config = config;
|
|
40
|
+
}
|
|
41
|
+
DOMPersistenceManager.prototype.watchElement = function (element, experimentName, change) {
|
|
42
|
+
var experiments = this.watchedElements.get(element);
|
|
43
|
+
if (!experiments) {
|
|
44
|
+
experiments = new Set();
|
|
45
|
+
this.watchedElements.set(element, experiments);
|
|
46
|
+
}
|
|
47
|
+
experiments.add(experimentName);
|
|
48
|
+
if (!this.appliedChanges.has(experimentName)) {
|
|
49
|
+
this.appliedChanges.set(experimentName, []);
|
|
50
|
+
}
|
|
51
|
+
var changes = this.appliedChanges.get(experimentName);
|
|
52
|
+
var isNewWatch = !changes.includes(change);
|
|
53
|
+
if (isNewWatch) {
|
|
54
|
+
changes.push(change);
|
|
55
|
+
if (this.config.debug) {
|
|
56
|
+
var currentStyles_1 = {};
|
|
57
|
+
if (change.value && typeof change.value === 'object') {
|
|
58
|
+
Object.keys(change.value).forEach(function (prop) {
|
|
59
|
+
var cssProp = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
60
|
+
currentStyles_1[cssProp] = element.style.getPropertyValue(cssProp);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
(0, debug_1.logDebug)('[WATCH-ELEMENT] Started watching element for persistence', {
|
|
64
|
+
experimentName: experimentName,
|
|
65
|
+
selector: change.selector,
|
|
66
|
+
element: element.tagName,
|
|
67
|
+
changeType: change.type,
|
|
68
|
+
value: change.value,
|
|
69
|
+
currentStyles: change.type === 'style' ? currentStyles_1 : undefined,
|
|
70
|
+
timestamp: Date.now(),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!this.persistenceObserver) {
|
|
75
|
+
this.setupPersistenceObserver();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
DOMPersistenceManager.prototype.unwatchElement = function (element, experimentName) {
|
|
79
|
+
var experiments = this.watchedElements.get(element);
|
|
80
|
+
if (experiments) {
|
|
81
|
+
experiments.delete(experimentName);
|
|
82
|
+
if (experiments.size === 0) {
|
|
83
|
+
this.watchedElements.delete(element);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
DOMPersistenceManager.prototype.unwatchExperiment = function (experimentName) {
|
|
88
|
+
this.appliedChanges.delete(experimentName);
|
|
89
|
+
};
|
|
90
|
+
DOMPersistenceManager.prototype.getAppliedChanges = function () {
|
|
91
|
+
return this.appliedChanges;
|
|
92
|
+
};
|
|
93
|
+
DOMPersistenceManager.prototype.clearAll = function () {
|
|
94
|
+
this.appliedChanges.clear();
|
|
95
|
+
};
|
|
96
|
+
DOMPersistenceManager.prototype.destroy = function () {
|
|
97
|
+
if (this.persistenceObserver) {
|
|
98
|
+
this.persistenceObserver.disconnect();
|
|
99
|
+
this.persistenceObserver = null;
|
|
100
|
+
}
|
|
101
|
+
this.appliedChanges.clear();
|
|
102
|
+
this.reapplyingElements.clear();
|
|
103
|
+
this.reapplyLogThrottle.clear();
|
|
104
|
+
};
|
|
105
|
+
DOMPersistenceManager.prototype.setupPersistenceObserver = function () {
|
|
106
|
+
var _this = this;
|
|
107
|
+
if (this.persistenceObserver)
|
|
108
|
+
return;
|
|
109
|
+
if (this.config.debug) {
|
|
110
|
+
(0, debug_1.logDebug)('[PERSISTENCE-OBSERVER] Setting up persistence observer', {
|
|
111
|
+
timestamp: Date.now(),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
this.persistenceObserver = new MutationObserver(function (mutations) {
|
|
115
|
+
if (_this.config.debug) {
|
|
116
|
+
(0, debug_1.logDebug)('[MUTATION-DETECTED] Persistence observer detected mutations', {
|
|
117
|
+
mutationCount: mutations.length,
|
|
118
|
+
timestamp: Date.now(),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
mutations.forEach(function (mutation) {
|
|
122
|
+
var element = mutation.target;
|
|
123
|
+
if (_this.reapplyingElements.has(element)) {
|
|
124
|
+
if (_this.config.debug) {
|
|
125
|
+
(0, debug_1.logDebug)('[MUTATION-SKIP] Skipping mutation - currently reapplying', {
|
|
126
|
+
element: element.tagName,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
var experiments = _this.watchedElements.get(element);
|
|
132
|
+
if (experiments) {
|
|
133
|
+
if (_this.config.debug) {
|
|
134
|
+
var elementKey = "mutation:".concat(element.tagName, ":").concat(element.getAttribute('name') || element.className);
|
|
135
|
+
var now = Date.now();
|
|
136
|
+
var lastLogged = _this.reapplyLogThrottle.get(elementKey) || 0;
|
|
137
|
+
if (now - lastLogged > 5000) {
|
|
138
|
+
(0, debug_1.logDebug)('[MUTATION-ON-WATCHED] Mutation detected on watched element', {
|
|
139
|
+
element: element.tagName,
|
|
140
|
+
attributeName: mutation.attributeName,
|
|
141
|
+
oldValue: mutation.oldValue,
|
|
142
|
+
experiments: Array.from(experiments),
|
|
143
|
+
});
|
|
144
|
+
_this.reapplyLogThrottle.set(elementKey, now);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
experiments.forEach(function (experimentName) {
|
|
148
|
+
var appliedChanges = _this.appliedChanges.get(experimentName);
|
|
149
|
+
if (appliedChanges) {
|
|
150
|
+
appliedChanges.forEach(function (change) {
|
|
151
|
+
var e_1, _a, e_2, _b;
|
|
152
|
+
var needsReapply = false;
|
|
153
|
+
if (change.type === 'style' &&
|
|
154
|
+
mutation.attributeName === 'style' &&
|
|
155
|
+
change.persistStyle !== false) {
|
|
156
|
+
needsReapply = _this.checkStyleOverwritten(element, change.value);
|
|
157
|
+
}
|
|
158
|
+
else if (change.type === 'attribute' && change.persistAttribute !== false) {
|
|
159
|
+
if (change.value && typeof change.value === 'object') {
|
|
160
|
+
try {
|
|
161
|
+
for (var _c = __values(Object.keys(change.value)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
162
|
+
var attrName = _d.value;
|
|
163
|
+
if (mutation.attributeName === attrName) {
|
|
164
|
+
needsReapply = _this.checkAttributeOverwritten(element, change.value);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
170
|
+
finally {
|
|
171
|
+
try {
|
|
172
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
173
|
+
}
|
|
174
|
+
finally { if (e_1) throw e_1.error; }
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (needsReapply) {
|
|
179
|
+
_this.reapplyingElements.add(element);
|
|
180
|
+
var logKey = "".concat(experimentName, "-").concat(change.selector);
|
|
181
|
+
var now = Date.now();
|
|
182
|
+
var lastLogged = _this.reapplyLogThrottle.get(logKey) || 0;
|
|
183
|
+
if (_this.config.debug && now - lastLogged > 5000) {
|
|
184
|
+
(0, debug_1.logDebug)('[REAPPLY-TRIGGERED] Reapplying after mutation (React/framework conflict detected)', {
|
|
185
|
+
experimentName: experimentName,
|
|
186
|
+
selector: change.selector,
|
|
187
|
+
element: element.tagName,
|
|
188
|
+
changeType: change.type,
|
|
189
|
+
timestamp: now,
|
|
190
|
+
});
|
|
191
|
+
_this.reapplyLogThrottle.set(logKey, now);
|
|
192
|
+
if (_this.reapplyLogThrottle.size > 100) {
|
|
193
|
+
var oldestAllowed = now - 60000;
|
|
194
|
+
try {
|
|
195
|
+
for (var _e = __values(_this.reapplyLogThrottle.entries()), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
196
|
+
var _g = __read(_f.value, 2), key = _g[0], time = _g[1];
|
|
197
|
+
if (time < oldestAllowed) {
|
|
198
|
+
_this.reapplyLogThrottle.delete(key);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
203
|
+
finally {
|
|
204
|
+
try {
|
|
205
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
206
|
+
}
|
|
207
|
+
finally { if (e_2) throw e_2.error; }
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
_this.config.onReapply(change, experimentName);
|
|
212
|
+
setTimeout(function () {
|
|
213
|
+
_this.reapplyingElements.delete(element);
|
|
214
|
+
}, 0);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
this.persistenceObserver.observe(document.body, {
|
|
223
|
+
attributes: true,
|
|
224
|
+
subtree: true,
|
|
225
|
+
attributeOldValue: true,
|
|
226
|
+
});
|
|
227
|
+
if (this.config.debug) {
|
|
228
|
+
(0, debug_1.logDebug)('[PERSISTENCE-OBSERVER] Setup complete - now observing mutations', {
|
|
229
|
+
target: 'document.body',
|
|
230
|
+
attributeFilter: ['style', 'class'],
|
|
231
|
+
subtree: true,
|
|
232
|
+
timestamp: Date.now(),
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
DOMPersistenceManager.prototype.checkStyleOverwritten = function (element, expectedStyles) {
|
|
237
|
+
var e_3, _a;
|
|
238
|
+
try {
|
|
239
|
+
for (var _b = __values(Object.entries(expectedStyles)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
240
|
+
var _d = __read(_c.value, 2), prop = _d[0], value = _d[1];
|
|
241
|
+
var cssProp = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
242
|
+
var currentValue = element.style.getPropertyValue(cssProp);
|
|
243
|
+
var currentPriority = element.style.getPropertyPriority(cssProp);
|
|
244
|
+
if (currentValue !== value || (value.includes('!important') && !currentPriority)) {
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
250
|
+
finally {
|
|
251
|
+
try {
|
|
252
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
253
|
+
}
|
|
254
|
+
finally { if (e_3) throw e_3.error; }
|
|
255
|
+
}
|
|
256
|
+
return false;
|
|
257
|
+
};
|
|
258
|
+
DOMPersistenceManager.prototype.checkAttributeOverwritten = function (element, expectedAttributes) {
|
|
259
|
+
var e_4, _a;
|
|
260
|
+
try {
|
|
261
|
+
for (var _b = __values(Object.entries(expectedAttributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
262
|
+
var _d = __read(_c.value, 2), attr = _d[0], value = _d[1];
|
|
263
|
+
var currentValue = element.getAttribute(attr);
|
|
264
|
+
if (currentValue !== value) {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
270
|
+
finally {
|
|
271
|
+
try {
|
|
272
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
273
|
+
}
|
|
274
|
+
finally { if (e_4) throw e_4.error; }
|
|
275
|
+
}
|
|
276
|
+
return false;
|
|
277
|
+
};
|
|
278
|
+
return DOMPersistenceManager;
|
|
279
|
+
}());
|
|
280
|
+
exports.DOMPersistenceManager = DOMPersistenceManager;
|
|
281
|
+
//# sourceMappingURL=persistence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.js","sourceRoot":"","sources":["../../src/utils/persistence.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAmC;AAQnC;IAQE,+BAAY,MAAyB;QAP7B,oBAAe,GAAkC,IAAI,OAAO,EAAE,CAAC;QAC/D,wBAAmB,GAA4B,IAAI,CAAC;QACpD,uBAAkB,GAAiB,IAAI,GAAG,EAAE,CAAC;QAC7C,uBA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 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global plugin registry for ABsmartly plugins
|
|
3
|
+
* Allows detection and inspection of loaded plugins
|
|
4
|
+
*/
|
|
5
|
+
export interface PluginRegistryEntry {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
initialized: boolean;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
capabilities?: string[];
|
|
11
|
+
instance?: any;
|
|
12
|
+
}
|
|
13
|
+
export interface PluginRegistry {
|
|
14
|
+
dom?: PluginRegistryEntry;
|
|
15
|
+
overrides?: PluginRegistryEntry;
|
|
16
|
+
cookie?: PluginRegistryEntry;
|
|
17
|
+
vitals?: PluginRegistryEntry;
|
|
18
|
+
urlRedirect?: PluginRegistryEntry;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface Window {
|
|
22
|
+
__ABSMARTLY_PLUGINS__?: PluginRegistry;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Register a plugin in the global registry
|
|
27
|
+
*/
|
|
28
|
+
export declare function registerPlugin(pluginType: keyof PluginRegistry, entry: PluginRegistryEntry): void;
|
|
29
|
+
/**
|
|
30
|
+
* Unregister a plugin from the global registry
|
|
31
|
+
*/
|
|
32
|
+
export declare function unregisterPlugin(pluginType: keyof PluginRegistry): void;
|
|
33
|
+
/**
|
|
34
|
+
* Check if a plugin is registered
|
|
35
|
+
*/
|
|
36
|
+
export declare function isPluginRegistered(pluginType: keyof PluginRegistry): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Get all registered plugins
|
|
39
|
+
*/
|
|
40
|
+
export declare function getRegisteredPlugins(): PluginRegistry;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Global plugin registry for ABsmartly plugins
|
|
4
|
+
* Allows detection and inspection of loaded plugins
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.registerPlugin = registerPlugin;
|
|
8
|
+
exports.unregisterPlugin = unregisterPlugin;
|
|
9
|
+
exports.isPluginRegistered = isPluginRegistered;
|
|
10
|
+
exports.getRegisteredPlugins = getRegisteredPlugins;
|
|
11
|
+
/**
|
|
12
|
+
* Register a plugin in the global registry
|
|
13
|
+
*/
|
|
14
|
+
function registerPlugin(pluginType, entry) {
|
|
15
|
+
if (typeof window === 'undefined') {
|
|
16
|
+
return; // Not in browser environment
|
|
17
|
+
}
|
|
18
|
+
if (!window.__ABSMARTLY_PLUGINS__) {
|
|
19
|
+
window.__ABSMARTLY_PLUGINS__ = {};
|
|
20
|
+
}
|
|
21
|
+
window.__ABSMARTLY_PLUGINS__[pluginType] = entry;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Unregister a plugin from the global registry
|
|
25
|
+
*/
|
|
26
|
+
function unregisterPlugin(pluginType) {
|
|
27
|
+
if (typeof window === 'undefined') {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (window.__ABSMARTLY_PLUGINS__) {
|
|
31
|
+
delete window.__ABSMARTLY_PLUGINS__[pluginType];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check if a plugin is registered
|
|
36
|
+
*/
|
|
37
|
+
function isPluginRegistered(pluginType) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (typeof window === 'undefined') {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return !!(window.__ABSMARTLY_PLUGINS__ && ((_a = window.__ABSMARTLY_PLUGINS__[pluginType]) === null || _a === void 0 ? void 0 : _a.initialized));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get all registered plugins
|
|
46
|
+
*/
|
|
47
|
+
function getRegisteredPlugins() {
|
|
48
|
+
if (typeof window === 'undefined') {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
return window.__ABSMARTLY_PLUGINS__ || {};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=plugin-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-registry.js","sourceRoot":"","sources":["../../src/utils/plugin-registry.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA4BH,wCAUC;AAKD,4CAQC;AAKD,gDAMC;AAKD,oDAMC;AAhDD;;GAEG;AACH,SAAgB,cAAc,CAAC,UAAgC,EAAE,KAA0B;IACzF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,CAAC,6BAA6B;IACvC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAClC,MAAM,CAAC,qBAAqB,GAAG,EAAE,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,qBAAqB,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,UAAgC;IAC/D,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,UAAgC;;IACjE,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,qBAAqB,KAAI,MAAA,MAAM,CAAC,qBAAqB,CAAC,UAAU,CAAC,0CAAE,WAAW,CAAA,CAAC,CAAC;AACnG,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB;IAClC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,qBAAqB,IAAI,EAAE,CAAC;AAC5C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absmartly/sdk-plugins",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Collection of plugins for ABsmartly JavaScript SDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"browser": "dist/absmartly-sdk-plugins.min.js",
|
|
8
8
|
"types": "types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"source": "./src/index.ts",
|
|
12
|
+
"types": "./types/index.d.ts",
|
|
13
|
+
"import": "./es/index.js",
|
|
14
|
+
"require": "./lib/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./dom-changes": {
|
|
17
|
+
"source": "./src/core/DOMChangesPluginLite.ts",
|
|
18
|
+
"types": "./types/core/DOMChangesPluginLite.d.ts",
|
|
19
|
+
"import": "./es/core/DOMChangesPluginLite.js",
|
|
20
|
+
"require": "./lib/core/DOMChangesPluginLite.js"
|
|
21
|
+
},
|
|
22
|
+
"./cookie": {
|
|
23
|
+
"source": "./src/cookies/CookiePlugin.ts",
|
|
24
|
+
"types": "./types/cookies/CookiePlugin.d.ts",
|
|
25
|
+
"import": "./es/cookies/CookiePlugin.js",
|
|
26
|
+
"require": "./lib/cookies/CookiePlugin.js"
|
|
27
|
+
},
|
|
28
|
+
"./web-vitals": {
|
|
29
|
+
"source": "./src/vitals/WebVitalsPlugin.ts",
|
|
30
|
+
"types": "./types/vitals/WebVitalsPlugin.d.ts",
|
|
31
|
+
"import": "./es/vitals/WebVitalsPlugin.js",
|
|
32
|
+
"require": "./lib/vitals/WebVitalsPlugin.js"
|
|
33
|
+
},
|
|
34
|
+
"./overrides": {
|
|
35
|
+
"source": "./src/overrides/overridesUtils.ts",
|
|
36
|
+
"types": "./types/overrides/overridesUtils.d.ts",
|
|
37
|
+
"import": "./es/overrides/overridesUtils.js",
|
|
38
|
+
"require": "./lib/overrides/overridesUtils.js"
|
|
39
|
+
},
|
|
40
|
+
"./url-redirect": {
|
|
41
|
+
"source": "./src/url-redirect/URLRedirectPlugin.ts",
|
|
42
|
+
"types": "./types/url-redirect/URLRedirectPlugin.d.ts",
|
|
43
|
+
"import": "./es/url-redirect/URLRedirectPlugin.js",
|
|
44
|
+
"require": "./lib/url-redirect/URLRedirectPlugin.js"
|
|
45
|
+
},
|
|
46
|
+
"./core/dom-manipulator": {
|
|
47
|
+
"source": "./src/core/DOMManipulatorLite.ts",
|
|
48
|
+
"types": "./types/core/DOMManipulatorLite.d.ts",
|
|
49
|
+
"import": "./es/core/DOMManipulatorLite.js",
|
|
50
|
+
"require": "./lib/core/DOMManipulatorLite.js"
|
|
51
|
+
},
|
|
52
|
+
"./core/style-sheet-manager": {
|
|
53
|
+
"source": "./src/core/StyleSheetManager.ts",
|
|
54
|
+
"types": "./types/core/StyleSheetManager.d.ts",
|
|
55
|
+
"import": "./es/core/StyleSheetManager.js",
|
|
56
|
+
"require": "./lib/core/StyleSheetManager.js"
|
|
57
|
+
},
|
|
58
|
+
"./core/pending-change-manager": {
|
|
59
|
+
"source": "./src/core/PendingChangeManager.ts",
|
|
60
|
+
"types": "./types/core/PendingChangeManager.d.ts",
|
|
61
|
+
"import": "./es/core/PendingChangeManager.js",
|
|
62
|
+
"require": "./lib/core/PendingChangeManager.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
9
65
|
"files": [
|
|
10
66
|
"lib",
|
|
11
67
|
"es",
|
|
@@ -19,15 +75,17 @@
|
|
|
19
75
|
"compile:cjs": "tsc -p tsconfig.cjs.json",
|
|
20
76
|
"compile:es": "tsc -p tsconfig.es.json",
|
|
21
77
|
"compile:types": "tsc -p tsconfig.types.json",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
78
|
+
"generate:build-info": "node scripts/generate-build-info.js",
|
|
79
|
+
"generate:build-info:debug": "node scripts/generate-build-info.js --debug",
|
|
80
|
+
"compile": "npm run generate:build-info && npm run compile:cjs && npm run compile:es && npm run compile:types",
|
|
81
|
+
"bundle": "npm run generate:build-info && webpack --mode production --env BUILD_TYPE=all",
|
|
24
82
|
"bundle:dom": "webpack --mode production --env BUILD_TYPE=dom-only",
|
|
25
83
|
"bundle:lite": "webpack --mode production --env BUILD_TYPE=dom-lite",
|
|
26
84
|
"bundle:full": "webpack --mode production --env BUILD_TYPE=dom-full",
|
|
27
85
|
"bundle:cookie": "webpack --mode production --env BUILD_TYPE=cookie-only",
|
|
28
86
|
"bundle:vitals": "webpack --mode production --env BUILD_TYPE=vitals-only",
|
|
29
87
|
"postbundle": "cp dist/*.min.js ../absmartly.com/static/ 2>/dev/null || true",
|
|
30
|
-
"bundle:dev": "webpack --mode development --env BUILD_TYPE=all --devtool source-map",
|
|
88
|
+
"bundle:dev": "npm run generate:build-info:debug && webpack --mode development --env BUILD_TYPE=all --devtool source-map",
|
|
31
89
|
"bundle:dev:all": "npm run bundle:dev:dom && npm run bundle:dev:lite && npm run bundle:dev:full && npm run bundle:dev:cookie && npm run bundle:dev:vitals && npm run bundle:dev:overrides",
|
|
32
90
|
"bundle:dev:dom": "webpack --mode development --env BUILD_TYPE=dom-only --devtool source-map",
|
|
33
91
|
"bundle:dev:lite": "webpack --mode development --env BUILD_TYPE=dom-lite --devtool source-map",
|
|
@@ -46,8 +104,8 @@
|
|
|
46
104
|
"dev:all": "npm run compile:cjs -- --watch & npm run compile:es -- --watch & npm run compile:types -- --watch",
|
|
47
105
|
"watch": "webpack --mode development --watch --env BUILD_TYPE=all --devtool source-map",
|
|
48
106
|
"prepublishOnly": "npm run build && npm test",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
107
|
+
"publish": "npm run build && npm publish --access public",
|
|
108
|
+
"publish:dry-run": "npm run build && npm publish --dry-run --access public",
|
|
51
109
|
"version:patch": "npm version patch",
|
|
52
110
|
"version:minor": "npm version minor",
|
|
53
111
|
"version:major": "npm version major"
|
|
@@ -4,6 +4,7 @@ import { VariantExtractor } from '../parsers/VariantExtractor';
|
|
|
4
4
|
import { StyleSheetManager } from './StyleSheetManager';
|
|
5
5
|
import { ExposureTracker } from './ExposureTracker';
|
|
6
6
|
import { HTMLInjector } from './HTMLInjector';
|
|
7
|
+
import { DOMPersistenceManager } from '../utils/persistence';
|
|
7
8
|
export declare class DOMChangesPluginLite {
|
|
8
9
|
static readonly VERSION: string;
|
|
9
10
|
protected config: Required<PluginConfig>;
|
|
@@ -16,11 +17,7 @@ export declare class DOMChangesPluginLite {
|
|
|
16
17
|
protected eventListeners: Map<string, EventCallback[]>;
|
|
17
18
|
protected styleManagers: Map<string, StyleSheetManager>;
|
|
18
19
|
protected initialized: boolean;
|
|
19
|
-
protected
|
|
20
|
-
protected persistenceObserver: MutationObserver | null;
|
|
21
|
-
protected reapplyingElements: Set<Element>;
|
|
22
|
-
protected reapplyLogThrottle: Map<string, number>;
|
|
23
|
-
protected appliedChanges: Map<string, DOMChange[]>;
|
|
20
|
+
protected persistenceManager: DOMPersistenceManager | null;
|
|
24
21
|
protected antiFlickerTimeout: number | null;
|
|
25
22
|
protected antiFlickerStyleId: string;
|
|
26
23
|
private readyPromise;
|
|
@@ -75,6 +72,14 @@ export declare class DOMChangesPluginLite {
|
|
|
75
72
|
destroy(): void;
|
|
76
73
|
protected registerWithContext(): void;
|
|
77
74
|
protected unregisterFromContext(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Register plugin in global registry for detection
|
|
77
|
+
*/
|
|
78
|
+
protected registerGlobally(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Unregister plugin from global registry
|
|
81
|
+
*/
|
|
82
|
+
protected unregisterGlobally(): void;
|
|
78
83
|
/**
|
|
79
84
|
* Hide content to prevent flicker before experiments are applied
|
|
80
85
|
*/
|
|
@@ -85,6 +90,4 @@ export declare class DOMChangesPluginLite {
|
|
|
85
90
|
private showContent;
|
|
86
91
|
watchElement(element: Element, experimentName: string, change: DOMChange): void;
|
|
87
92
|
unwatchElement(element: Element, experimentName: string): void;
|
|
88
|
-
private setupPersistenceObserver;
|
|
89
|
-
private checkStyleOverwritten;
|
|
90
93
|
}
|
|
@@ -20,6 +20,12 @@ export declare class ExposureTracker {
|
|
|
20
20
|
* Uses inline-block with minimal dimensions to be observable but not affect layout
|
|
21
21
|
*/
|
|
22
22
|
private createContainerPlaceholder;
|
|
23
|
+
/**
|
|
24
|
+
* Create an in-place placeholder that replaces a deleted element
|
|
25
|
+
* This allows viewport tracking for delete changes
|
|
26
|
+
* Returns the number of placeholders created
|
|
27
|
+
*/
|
|
28
|
+
private createInPlacePlaceholder;
|
|
23
29
|
/**
|
|
24
30
|
* Get the original parent selector for move changes
|
|
25
31
|
* This should be called BEFORE the move is applied
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
import { DOMChangesPluginLite } from '../core/DOMChangesPluginLite';
|
|
6
6
|
import { OverridesPluginLite } from '../overrides/OverridesPluginLite';
|
|
7
7
|
import { CookiePlugin } from '../cookies/CookiePlugin';
|
|
8
|
+
import { DOMPersistenceManager } from '../utils/persistence';
|
|
8
9
|
export * from '../types';
|
|
9
10
|
export * from '../overrides/types';
|
|
10
11
|
export type { CookiePluginOptions } from '../cookies/CookiePlugin';
|
|
11
12
|
export type { CookieOptions } from '../cookies/cookieUtils';
|
|
12
13
|
export { DOMChangesPluginLite, OverridesPluginLite, CookiePlugin };
|
|
13
14
|
export { DOMChangesPluginLite as DOMChangesPlugin };
|
|
15
|
+
export { DOMPersistenceManager };
|
|
14
16
|
export { getCookie, setCookie, deleteCookie, generateUniqueId, generateUUID, isLocalStorageAvailable, } from '../cookies/cookieUtils';
|
|
15
17
|
export { getQueryStringOverrides, parseOverrideCookie, getCookieOverrides as getOverrideCookie, serializeOverrides, persistOverridesToCookie, getOverrides, } from '../overrides/overridesUtils';
|
|
16
18
|
export type { SimpleOverride, OverrideOptions } from '../overrides/overridesUtils';
|
package/types/index.d.ts
CHANGED
|
@@ -3,15 +3,21 @@ import { OverridesPlugin } from './overrides/OverridesPlugin';
|
|
|
3
3
|
import { BrowserCookieAdapter } from './overrides/BrowserCookieAdapter';
|
|
4
4
|
import { CookiePlugin } from './cookies/CookiePlugin';
|
|
5
5
|
import { WebVitalsPlugin } from './vitals/WebVitalsPlugin';
|
|
6
|
+
import { URLRedirectPlugin } from './url-redirect/URLRedirectPlugin';
|
|
6
7
|
export * from './types';
|
|
7
8
|
export * from './overrides/types';
|
|
9
|
+
export * from './url-redirect/types';
|
|
8
10
|
export type { CookiePluginOptions } from './cookies/CookiePlugin';
|
|
9
11
|
export type { CookieOptions } from './cookies/cookieUtils';
|
|
10
12
|
export type { WebVitalsPluginOptions, Metric } from './vitals/WebVitalsPlugin';
|
|
11
13
|
export { DOMChangesPluginLite, DOMChangesPluginLite as DOMChangesPlugin, // Alias for backward compatibility
|
|
12
14
|
OverridesPlugin, // Legacy export - this is the original full-featured version
|
|
13
|
-
BrowserCookieAdapter, CookiePlugin, WebVitalsPlugin, };
|
|
15
|
+
BrowserCookieAdapter, CookiePlugin, WebVitalsPlugin, URLRedirectPlugin, };
|
|
14
16
|
export { getCookie, setCookie, deleteCookie, generateUniqueId, generateUUID, isLocalStorageAvailable, } from './cookies/cookieUtils';
|
|
15
|
-
export { getQueryStringOverrides, parseOverrideCookie, getCookieOverrides, serializeOverrides, persistOverridesToCookie, getOverrides, } from './overrides/overridesUtils';
|
|
17
|
+
export { DEFAULT_OVERRIDE_COOKIE_NAME, DEFAULT_OVERRIDE_QUERY_PREFIX, getQueryStringOverrides, parseOverrideCookie, getCookieOverrides, serializeOverrides, persistOverridesToCookie, getOverrides, } from './overrides/overridesUtils';
|
|
16
18
|
export type { SimpleOverride, OverrideOptions } from './overrides/overridesUtils';
|
|
19
|
+
export { registerPlugin, unregisterPlugin, isPluginRegistered, getRegisteredPlugins, } from './utils/plugin-registry';
|
|
20
|
+
export type { PluginRegistry, PluginRegistryEntry } from './utils/plugin-registry';
|
|
21
|
+
export { URLRedirectExtractor } from './url-redirect/URLRedirectExtractor';
|
|
22
|
+
export { URLRedirectMatcher } from './url-redirect/URLRedirectMatcher';
|
|
17
23
|
export default DOMChangesPluginLite;
|
|
@@ -23,5 +23,13 @@ export declare class OverridesPluginLite {
|
|
|
23
23
|
protected registerWithContext(): void;
|
|
24
24
|
protected unregisterFromContext(): void;
|
|
25
25
|
destroy(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Register plugin in global registry for detection
|
|
28
|
+
*/
|
|
29
|
+
protected registerGlobally(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Unregister plugin from global registry
|
|
32
|
+
*/
|
|
33
|
+
protected unregisterGlobally(): void;
|
|
26
34
|
}
|
|
27
35
|
export {};
|