fck-honey 0.2.1 → 0.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/README.md +10 -13
- package/dist/esm/index.js +12 -2
- package/dist/honey-detect.js +12 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,10 +9,9 @@ Open source lib for Merchants to detect if an end user has Honey browser extensi
|
|
|
9
9
|
```html
|
|
10
10
|
<script src="https://cdn.jsdelivr.net/npm/fck-honey/dist/honey-detect.min.js"></script>
|
|
11
11
|
<script>
|
|
12
|
-
|
|
13
|
-
// Decide how you want to handle this.
|
|
14
|
-
|
|
15
|
-
console.log("Honey overlay detected:", el);
|
|
12
|
+
window.fckHoney.listen((warn) => {
|
|
13
|
+
// Decide how you want to handle this. Native warn function allows you to tell the user to disable Honey.
|
|
14
|
+
warn("You must disable the Honey extension to continue.");
|
|
16
15
|
});
|
|
17
16
|
</script>
|
|
18
17
|
```
|
|
@@ -26,19 +25,17 @@ npm install fck-honey
|
|
|
26
25
|
```js
|
|
27
26
|
import { listen } from "fck-honey";
|
|
28
27
|
|
|
29
|
-
listen((
|
|
30
|
-
// Decide how you want to handle this.
|
|
31
|
-
|
|
32
|
-
console.log("Honey overlay detected:", el);
|
|
28
|
+
listen((warn) => {
|
|
29
|
+
// Decide how you want to handle this. Native warn function allows you to tell the user to disable Honey.
|
|
30
|
+
warn("You must disable the Honey extension to continue.");
|
|
33
31
|
});
|
|
34
32
|
```
|
|
35
33
|
|
|
36
34
|
## Advanced Options
|
|
37
35
|
|
|
38
36
|
```js
|
|
39
|
-
window.fckHoney.listen((
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
}, { removeHoney: true });
|
|
37
|
+
window.fckHoney.listen((warn, el) => {
|
|
38
|
+
// removeHoney defaults to true (element is auto-removed).
|
|
39
|
+
// Set removeHoney to false if you want to keep the Honey element for some reason.
|
|
40
|
+
}, { removeHoney: false });
|
|
44
41
|
```
|
package/dist/esm/index.js
CHANGED
|
@@ -88,7 +88,12 @@ function scanElement(el, seen, zNearMax, uuidGate, debug, removeHoney, onMatch,
|
|
|
88
88
|
seen.push(el);
|
|
89
89
|
if (removeHoney && el.parentNode)
|
|
90
90
|
el.parentNode.removeChild(el);
|
|
91
|
-
|
|
91
|
+
if (removeHoney) {
|
|
92
|
+
onMatch(warn);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
onMatch(warn, el);
|
|
96
|
+
}
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
var divs = (_a = el.querySelectorAll) === null || _a === void 0 ? void 0 : _a.call(el, TARGET_SELECTOR);
|
|
@@ -100,7 +105,12 @@ function scanElement(el, seen, zNearMax, uuidGate, debug, removeHoney, onMatch,
|
|
|
100
105
|
seen.push(d);
|
|
101
106
|
if (removeHoney && d.parentNode)
|
|
102
107
|
d.parentNode.removeChild(d);
|
|
103
|
-
|
|
108
|
+
if (removeHoney) {
|
|
109
|
+
onMatch(warn);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
onMatch(warn, d);
|
|
113
|
+
}
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
}
|
package/dist/honey-detect.js
CHANGED
|
@@ -89,7 +89,12 @@ function scanElement(el, seen, zNearMax, uuidGate, debug, removeHoney, onMatch,
|
|
|
89
89
|
seen.push(el);
|
|
90
90
|
if (removeHoney && el.parentNode)
|
|
91
91
|
el.parentNode.removeChild(el);
|
|
92
|
-
|
|
92
|
+
if (removeHoney) {
|
|
93
|
+
onMatch(warn);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
onMatch(warn, el);
|
|
97
|
+
}
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
var divs = (_a = el.querySelectorAll) === null || _a === void 0 ? void 0 : _a.call(el, TARGET_SELECTOR);
|
|
@@ -101,7 +106,12 @@ function scanElement(el, seen, zNearMax, uuidGate, debug, removeHoney, onMatch,
|
|
|
101
106
|
seen.push(d);
|
|
102
107
|
if (removeHoney && d.parentNode)
|
|
103
108
|
d.parentNode.removeChild(d);
|
|
104
|
-
|
|
109
|
+
if (removeHoney) {
|
|
110
|
+
onMatch(warn);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
onMatch(warn, d);
|
|
114
|
+
}
|
|
105
115
|
}
|
|
106
116
|
}
|
|
107
117
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type WarnCallback = (message: string) => () => void;
|
|
2
|
-
export type MatchCallback = (
|
|
2
|
+
export type MatchCallback = (warn: WarnCallback, el?: HTMLDivElement) => void;
|
|
3
3
|
export interface ObserverOptions {
|
|
4
4
|
onMatch?: MatchCallback;
|
|
5
5
|
uuidGate?: boolean;
|