fck-honey 0.3.9 → 0.3.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/README.md CHANGED
@@ -16,7 +16,7 @@ This will automatically listen for Honey and show a default warning to the user
16
16
  <script>
17
17
  window.fckHoney.listen((warn, el, vendor) => {
18
18
  // Decide how you want to handle this. Native warn function allows you to tell the user to disable Honey.
19
- // vendor is "honey" or "Capital One Shopping"
19
+ // vendor is "honey", "Capital One Shopping", or "Rakuten"
20
20
  warn("You must disable the Honey extension to continue.");
21
21
  });
22
22
  </script>
@@ -33,7 +33,7 @@ import { listen } from "fck-honey";
33
33
 
34
34
  listen((warn, el, vendor) => {
35
35
  // Decide how you want to handle this. Native warn function allows you to tell the user to disable Honey.
36
- // vendor is "honey" or "Capital One Shopping"
36
+ // vendor is "honey", "Capital One Shopping", or "Rakuten"
37
37
  warn("You must disable the Honey extension to continue.");
38
38
  });
39
39
  ```
@@ -44,7 +44,7 @@ listen((warn, el, vendor) => {
44
44
  window.fckHoney.listen((warn, el, vendor) => {
45
45
  // removeHoney defaults to true (element is auto-removed).
46
46
  // Set removeHoney to false if you want to keep the Honey element for some reason.
47
- // vendor is "honey" or "Capital One Shopping"
47
+ // vendor is "honey", "Capital One Shopping", or "Rakuten"
48
48
  }, { removeHoney: false });
49
49
  ```
50
50
 
package/dist/auto.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function() {
2
2
  // dist/bundle-tmp/version.js
3
- var VERSION = "0.3.9";
3
+ var VERSION = "0.3.10";
4
4
 
5
5
  // dist/bundle-tmp/core.js
6
6
  var __assign = function() {
@@ -83,11 +83,6 @@
83
83
  console.log("+++ reject: display none", el);
84
84
  return false;
85
85
  }
86
- if (el.shadowRoot) {
87
- if (debug)
88
- console.log("+++ reject: shadowRoot", el);
89
- return false;
90
- }
91
86
  return true;
92
87
  }
93
88
  var cs = getComputedStyle(el);
@@ -102,17 +97,14 @@
102
97
  console.log("+++ reject: display none", el);
103
98
  return false;
104
99
  }
105
- if (el.shadowRoot) {
106
- if (debug)
107
- console.log("+++ reject: shadowRoot", el);
108
- return false;
109
- }
110
100
  return true;
111
101
  }
112
102
  var VENDOR_MATCHERS = [
113
103
  {
114
104
  name: "honey",
115
- matches: function(el, uuidGate, debug) {
105
+ matches: function(el, zNearMax, uuidGate, debug) {
106
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
107
+ return false;
116
108
  if (!el.id) {
117
109
  if (debug)
118
110
  console.log("+++ reject: no id", el);
@@ -123,30 +115,57 @@
123
115
  console.log("+++ reject: uuid", el.id);
124
116
  return false;
125
117
  }
118
+ if (el.shadowRoot) {
119
+ if (debug)
120
+ console.log("+++ reject: shadowRoot", el);
121
+ return false;
122
+ }
126
123
  return true;
127
124
  }
128
125
  },
129
126
  {
130
127
  name: "Capital One Shopping",
131
- matches: function(el, _uuidGate, debug) {
128
+ matches: function(el, zNearMax, _uuidGate, debug) {
129
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
130
+ return false;
132
131
  var dataGuid = getDataGuidAttribute(el);
133
132
  if (!dataGuid) {
134
133
  if (debug)
135
134
  console.log("+++ reject: no data guid", el);
136
135
  return false;
137
136
  }
137
+ if (el.shadowRoot) {
138
+ if (debug)
139
+ console.log("+++ reject: shadowRoot", el);
140
+ return false;
141
+ }
138
142
  if (debug)
139
143
  console.log("+++ match capitalone", dataGuid, el);
140
144
  return true;
141
145
  }
146
+ },
147
+ {
148
+ name: "Rakuten",
149
+ matches: function(el, _zNearMax, _uuidGate, debug) {
150
+ if (!el.shadowRoot) {
151
+ if (debug)
152
+ console.log("+++ reject: no shadowRoot", el);
153
+ return false;
154
+ }
155
+ var style = el.shadowRoot.querySelector("style#rr-style-content");
156
+ if (!style) {
157
+ if (debug)
158
+ console.log("+++ reject: no rr-style-content", el);
159
+ return false;
160
+ }
161
+ return true;
162
+ }
142
163
  }
143
164
  ];
144
165
  function getVendorForDiv(el, zNearMax, uuidGate, debug) {
145
- if (!hasNearMaxZIndex(el, zNearMax, debug))
146
- return null;
147
166
  for (var i = 0; i < VENDOR_MATCHERS.length; i += 1) {
148
167
  var matcher = VENDOR_MATCHERS[i];
149
- if (matcher.matches(el, uuidGate, debug)) {
168
+ if (matcher.matches(el, zNearMax, uuidGate, debug)) {
150
169
  if (debug)
151
170
  console.log("+++ match", matcher.name, el);
152
171
  return matcher.name;
@@ -271,14 +290,15 @@
271
290
  function buildAutoModalHtml(vendor) {
272
291
  var query = encodeURIComponent("Why is the " + vendor + " browser extension shady, and how can i uninstall it?");
273
292
  var helpUrl = "http://chatgpt.com/?q=" + query;
274
- return '<div class="modal" role="dialog" aria-modal="true" aria-labelledby="honey-modal-title"><h2 id="honey-modal-title"><span style="font-weight:400;">This site can\u2019t proceed with </span><strong style="text-transform:uppercase;">' + vendor + '</strong><span style="font-weight:400;"> Extension enabled</span></h2><div style="display:flex;gap:8px;flex-wrap:wrap;margin:8px 0 12px 0;align-items:stretch;"><a href="' + helpUrl + '" target="_blank" rel="noopener noreferrer" style="display:flex;align-items:center;justify-content:center;text-align:center;min-height:52px;padding:10px 12px;background:#e6eef7;color:#0b1b2b;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;border-radius:6px;flex:1 1 240px;">Please disable it to continue your checkout. \u26D4\uFE0F</a><a href="https://www.youtube.com/watch?v=wwB3FmbcC88" target="_blank" rel="noopener noreferrer" style="display:flex;align-items:center;justify-content:center;text-align:center;min-height:52px;padding:10px 12px;background:#e6eef7;color:#0b1b2b;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;border-radius:6px;flex:1 1 240px;">Here is why \uD83C\uDFA5</a></div></div>';
293
+ return '<div class="modal" role="dialog" aria-modal="true" aria-labelledby="honey-modal-title"><h2 id="honey-modal-title"><span style="font-weight:400;">This site can\u2019t proceed with </span><strong>' + vendor + '</strong><span style="font-weight:400;"> Extension enabled</span></h2><div style="display:flex;gap:8px;flex-wrap:wrap;margin:8px 0 12px 0;align-items:stretch;"><a href="' + helpUrl + '" target="_blank" rel="noopener noreferrer" style="display:flex;align-items:center;justify-content:center;text-align:center;min-height:52px;padding:10px 12px;background:#e6eef7;color:#0b1b2b;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;border-radius:6px;flex:1 1 240px;">Please disable it to continue your checkout. \u26D4\uFE0F</a><a href="https://www.youtube.com/watch?v=wwB3FmbcC88" target="_blank" rel="noopener noreferrer" style="display:flex;align-items:center;justify-content:center;text-align:center;min-height:52px;padding:10px 12px;background:#e6eef7;color:#0b1b2b;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;border-radius:6px;flex:1 1 240px;">Here is why \uD83C\uDFA5</a></div></div>';
275
294
  }
276
295
  if (typeof window !== "undefined") {
277
296
  window.fckHoney = window.fckHoney || {};
278
297
  window.fckHoney.listen = listen;
279
298
  window.fckHoney.version = version;
280
299
  window.fckHoneyHandle = window.fckHoney.listen(function(warn, _el, vendor) {
281
- var vendorLabel = vendor || "honey";
300
+ var vendorName = vendor || "honey";
301
+ var vendorLabel = vendorName.charAt(0).toUpperCase() + vendorName.slice(1);
282
302
  warn(buildAutoModalHtml(vendorLabel));
283
303
  });
284
304
  }
@@ -5,7 +5,7 @@ function buildAutoModalHtml(vendor) {
5
5
  return ('<div class="modal" role="dialog" aria-modal="true" aria-labelledby="honey-modal-title">' +
6
6
  '<h2 id="honey-modal-title">' +
7
7
  '<span style="font-weight:400;">This site can’t proceed with </span>' +
8
- '<strong style="text-transform:uppercase;">' +
8
+ "<strong>" +
9
9
  vendor +
10
10
  '</strong><span style="font-weight:400;"> Extension enabled</span>' +
11
11
  "</h2>" +
@@ -21,7 +21,8 @@ if (typeof window !== "undefined") {
21
21
  window.fckHoney.listen = listen;
22
22
  window.fckHoney.version = version;
23
23
  window.fckHoneyHandle = window.fckHoney.listen(function (warn, _el, vendor) {
24
- var vendorLabel = vendor || "honey";
24
+ var vendorName = vendor || "honey";
25
+ var vendorLabel = vendorName.charAt(0).toUpperCase() + vendorName.slice(1);
25
26
  warn(buildAutoModalHtml(vendorLabel));
26
27
  });
27
28
  }
@@ -81,11 +81,6 @@ function hasNearMaxZIndex(el, zNearMax, debug) {
81
81
  console.log("+++ reject: display none", el);
82
82
  return false;
83
83
  }
84
- if (el.shadowRoot) {
85
- if (debug)
86
- console.log("+++ reject: shadowRoot", el);
87
- return false;
88
- }
89
84
  return true;
90
85
  }
91
86
  var cs = getComputedStyle(el);
@@ -100,18 +95,15 @@ function hasNearMaxZIndex(el, zNearMax, debug) {
100
95
  console.log("+++ reject: display none", el);
101
96
  return false;
102
97
  }
103
- if (el.shadowRoot) {
104
- if (debug)
105
- console.log("+++ reject: shadowRoot", el);
106
- return false;
107
- }
108
98
  return true;
109
99
  }
110
100
  // Each matcher should only check vendor-specific flags; shared z-index gating happens earlier.
111
101
  var VENDOR_MATCHERS = [
112
102
  {
113
103
  name: "honey",
114
- matches: function (el, uuidGate, debug) {
104
+ matches: function (el, zNearMax, uuidGate, debug) {
105
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
106
+ return false;
115
107
  if (!el.id) {
116
108
  if (debug)
117
109
  console.log("+++ reject: no id", el);
@@ -122,30 +114,57 @@ var VENDOR_MATCHERS = [
122
114
  console.log("+++ reject: uuid", el.id);
123
115
  return false;
124
116
  }
117
+ if (el.shadowRoot) {
118
+ if (debug)
119
+ console.log("+++ reject: shadowRoot", el);
120
+ return false;
121
+ }
125
122
  return true;
126
123
  }
127
124
  },
128
125
  {
129
126
  name: "Capital One Shopping",
130
- matches: function (el, _uuidGate, debug) {
127
+ matches: function (el, zNearMax, _uuidGate, debug) {
128
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
129
+ return false;
131
130
  var dataGuid = getDataGuidAttribute(el);
132
131
  if (!dataGuid) {
133
132
  if (debug)
134
133
  console.log("+++ reject: no data guid", el);
135
134
  return false;
136
135
  }
136
+ if (el.shadowRoot) {
137
+ if (debug)
138
+ console.log("+++ reject: shadowRoot", el);
139
+ return false;
140
+ }
137
141
  if (debug)
138
142
  console.log("+++ match capitalone", dataGuid, el);
139
143
  return true;
140
144
  }
145
+ },
146
+ {
147
+ name: "Rakuten",
148
+ matches: function (el, _zNearMax, _uuidGate, debug) {
149
+ if (!el.shadowRoot) {
150
+ if (debug)
151
+ console.log("+++ reject: no shadowRoot", el);
152
+ return false;
153
+ }
154
+ var style = el.shadowRoot.querySelector("style#rr-style-content");
155
+ if (!style) {
156
+ if (debug)
157
+ console.log("+++ reject: no rr-style-content", el);
158
+ return false;
159
+ }
160
+ return true;
161
+ }
141
162
  }
142
163
  ];
143
164
  function getVendorForDiv(el, zNearMax, uuidGate, debug) {
144
- if (!hasNearMaxZIndex(el, zNearMax, debug))
145
- return null;
146
165
  for (var i = 0; i < VENDOR_MATCHERS.length; i += 1) {
147
166
  var matcher = VENDOR_MATCHERS[i];
148
- if (matcher.matches(el, uuidGate, debug)) {
167
+ if (matcher.matches(el, zNearMax, uuidGate, debug)) {
149
168
  if (debug)
150
169
  console.log("+++ match", matcher.name, el);
151
170
  return matcher.name;
@@ -1,2 +1,2 @@
1
1
  // Auto-generated from package.json. Do not edit by hand.
2
- export var VERSION = "0.3.9";
2
+ export var VERSION = "0.3.10";
package/dist/esm/core.js CHANGED
@@ -81,11 +81,6 @@ function hasNearMaxZIndex(el, zNearMax, debug) {
81
81
  console.log("+++ reject: display none", el);
82
82
  return false;
83
83
  }
84
- if (el.shadowRoot) {
85
- if (debug)
86
- console.log("+++ reject: shadowRoot", el);
87
- return false;
88
- }
89
84
  return true;
90
85
  }
91
86
  var cs = getComputedStyle(el);
@@ -100,18 +95,15 @@ function hasNearMaxZIndex(el, zNearMax, debug) {
100
95
  console.log("+++ reject: display none", el);
101
96
  return false;
102
97
  }
103
- if (el.shadowRoot) {
104
- if (debug)
105
- console.log("+++ reject: shadowRoot", el);
106
- return false;
107
- }
108
98
  return true;
109
99
  }
110
100
  // Each matcher should only check vendor-specific flags; shared z-index gating happens earlier.
111
101
  var VENDOR_MATCHERS = [
112
102
  {
113
103
  name: "honey",
114
- matches: function (el, uuidGate, debug) {
104
+ matches: function (el, zNearMax, uuidGate, debug) {
105
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
106
+ return false;
115
107
  if (!el.id) {
116
108
  if (debug)
117
109
  console.log("+++ reject: no id", el);
@@ -122,30 +114,57 @@ var VENDOR_MATCHERS = [
122
114
  console.log("+++ reject: uuid", el.id);
123
115
  return false;
124
116
  }
117
+ if (el.shadowRoot) {
118
+ if (debug)
119
+ console.log("+++ reject: shadowRoot", el);
120
+ return false;
121
+ }
125
122
  return true;
126
123
  }
127
124
  },
128
125
  {
129
126
  name: "Capital One Shopping",
130
- matches: function (el, _uuidGate, debug) {
127
+ matches: function (el, zNearMax, _uuidGate, debug) {
128
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
129
+ return false;
131
130
  var dataGuid = getDataGuidAttribute(el);
132
131
  if (!dataGuid) {
133
132
  if (debug)
134
133
  console.log("+++ reject: no data guid", el);
135
134
  return false;
136
135
  }
136
+ if (el.shadowRoot) {
137
+ if (debug)
138
+ console.log("+++ reject: shadowRoot", el);
139
+ return false;
140
+ }
137
141
  if (debug)
138
142
  console.log("+++ match capitalone", dataGuid, el);
139
143
  return true;
140
144
  }
145
+ },
146
+ {
147
+ name: "Rakuten",
148
+ matches: function (el, _zNearMax, _uuidGate, debug) {
149
+ if (!el.shadowRoot) {
150
+ if (debug)
151
+ console.log("+++ reject: no shadowRoot", el);
152
+ return false;
153
+ }
154
+ var style = el.shadowRoot.querySelector("style#rr-style-content");
155
+ if (!style) {
156
+ if (debug)
157
+ console.log("+++ reject: no rr-style-content", el);
158
+ return false;
159
+ }
160
+ return true;
161
+ }
141
162
  }
142
163
  ];
143
164
  function getVendorForDiv(el, zNearMax, uuidGate, debug) {
144
- if (!hasNearMaxZIndex(el, zNearMax, debug))
145
- return null;
146
165
  for (var i = 0; i < VENDOR_MATCHERS.length; i += 1) {
147
166
  var matcher = VENDOR_MATCHERS[i];
148
- if (matcher.matches(el, uuidGate, debug)) {
167
+ if (matcher.matches(el, zNearMax, uuidGate, debug)) {
149
168
  if (debug)
150
169
  console.log("+++ match", matcher.name, el);
151
170
  return matcher.name;
@@ -1,2 +1,2 @@
1
1
  // Auto-generated from package.json. Do not edit by hand.
2
- export var VERSION = "0.3.9";
2
+ export var VERSION = "0.3.10";
@@ -1,6 +1,6 @@
1
1
  (function() {
2
2
  // dist/bundle-tmp/version.js
3
- var VERSION = "0.3.9";
3
+ var VERSION = "0.3.10";
4
4
 
5
5
  // dist/bundle-tmp/core.js
6
6
  var __assign = function() {
@@ -83,11 +83,6 @@
83
83
  console.log("+++ reject: display none", el);
84
84
  return false;
85
85
  }
86
- if (el.shadowRoot) {
87
- if (debug)
88
- console.log("+++ reject: shadowRoot", el);
89
- return false;
90
- }
91
86
  return true;
92
87
  }
93
88
  var cs = getComputedStyle(el);
@@ -102,17 +97,14 @@
102
97
  console.log("+++ reject: display none", el);
103
98
  return false;
104
99
  }
105
- if (el.shadowRoot) {
106
- if (debug)
107
- console.log("+++ reject: shadowRoot", el);
108
- return false;
109
- }
110
100
  return true;
111
101
  }
112
102
  var VENDOR_MATCHERS = [
113
103
  {
114
104
  name: "honey",
115
- matches: function(el, uuidGate, debug) {
105
+ matches: function(el, zNearMax, uuidGate, debug) {
106
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
107
+ return false;
116
108
  if (!el.id) {
117
109
  if (debug)
118
110
  console.log("+++ reject: no id", el);
@@ -123,30 +115,57 @@
123
115
  console.log("+++ reject: uuid", el.id);
124
116
  return false;
125
117
  }
118
+ if (el.shadowRoot) {
119
+ if (debug)
120
+ console.log("+++ reject: shadowRoot", el);
121
+ return false;
122
+ }
126
123
  return true;
127
124
  }
128
125
  },
129
126
  {
130
127
  name: "Capital One Shopping",
131
- matches: function(el, _uuidGate, debug) {
128
+ matches: function(el, zNearMax, _uuidGate, debug) {
129
+ if (!hasNearMaxZIndex(el, zNearMax, debug))
130
+ return false;
132
131
  var dataGuid = getDataGuidAttribute(el);
133
132
  if (!dataGuid) {
134
133
  if (debug)
135
134
  console.log("+++ reject: no data guid", el);
136
135
  return false;
137
136
  }
137
+ if (el.shadowRoot) {
138
+ if (debug)
139
+ console.log("+++ reject: shadowRoot", el);
140
+ return false;
141
+ }
138
142
  if (debug)
139
143
  console.log("+++ match capitalone", dataGuid, el);
140
144
  return true;
141
145
  }
146
+ },
147
+ {
148
+ name: "Rakuten",
149
+ matches: function(el, _zNearMax, _uuidGate, debug) {
150
+ if (!el.shadowRoot) {
151
+ if (debug)
152
+ console.log("+++ reject: no shadowRoot", el);
153
+ return false;
154
+ }
155
+ var style = el.shadowRoot.querySelector("style#rr-style-content");
156
+ if (!style) {
157
+ if (debug)
158
+ console.log("+++ reject: no rr-style-content", el);
159
+ return false;
160
+ }
161
+ return true;
162
+ }
142
163
  }
143
164
  ];
144
165
  function getVendorForDiv(el, zNearMax, uuidGate, debug) {
145
- if (!hasNearMaxZIndex(el, zNearMax, debug))
146
- return null;
147
166
  for (var i = 0; i < VENDOR_MATCHERS.length; i += 1) {
148
167
  var matcher = VENDOR_MATCHERS[i];
149
- if (matcher.matches(el, uuidGate, debug)) {
168
+ if (matcher.matches(el, zNearMax, uuidGate, debug)) {
150
169
  if (debug)
151
170
  console.log("+++ match", matcher.name, el);
152
171
  return matcher.name;
@@ -1,6 +1,6 @@
1
- export declare const version = "0.3.9";
1
+ export declare const version = "0.3.10";
2
2
  export type WarnCallback = (message: string) => () => void;
3
- export type DetectedVendor = "honey" | "Capital One Shopping";
3
+ export type DetectedVendor = "honey" | "Capital One Shopping" | "Rakuten";
4
4
  export type MatchCallback = (warn: WarnCallback, el?: HTMLDivElement, vendor?: DetectedVendor) => void;
5
5
  export interface ObserverOptions {
6
6
  onMatch?: MatchCallback;
@@ -1 +1 @@
1
- export declare const VERSION = "0.3.9";
1
+ export declare const VERSION = "0.3.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fck-honey",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "Detects Honey browser extension overlays for merchants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/honey-detect.js",