coupon-shield 0.3.11 → 0.3.12

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
@@ -5,9 +5,7 @@ Tool for eComm merchants to detect, warn and prevent a customer from shopping us
5
5
  <img width="1307" height="561" alt="image" src="https://github.com/user-attachments/assets/33b2554b-fc90-4b4b-b917-4ed088664200" />
6
6
 
7
7
  ## Easy install (no-JS)
8
- This will automatically listen for Honey and show a default warning to the user to disable the extension as shown above).
9
-
10
- Install this at the very top of the `<head>` in your webpage to ensure it runs prior to Honey.
8
+ This will automatically detect a coupon extension and show a default warning to the user to disable the extension as shown above). Install this at the very top of the `<head>` in your webpage to ensure it runs prior to the extension.
11
9
  [jsDelivr package page](https://www.jsdelivr.com/package/npm/coupon-shield).
12
10
  ```html
13
11
  <script src="https://cdn.jsdelivr.net/npm/coupon-shield@latest/dist/auto.min.js"></script>
@@ -16,10 +14,10 @@ Install this at the very top of the `<head>` in your webpage to ensure it runs p
16
14
  ## Custom Usage (Browser Global)
17
15
 
18
16
  ```html
19
- <script src="https://cdn.jsdelivr.net/npm/coupon-shield@latest/dist/couponshield.js"></script>
17
+ <script src="https://cdn.jsdelivr.net/npm/coupon-shield@latest/dist/couponshield.min.js"></script>
20
18
  <script>
21
- window.couponShield.listen((warn, el, vendor) => {
22
- // Decide how you want to handle this. Native warn function allows you to tell the user to disable Honey.
19
+ window.couponShield.listen((warn, vendor) => {
20
+ // Decide how you want to handle this. Native warn function allows you to tell the user to disable the extension.
23
21
  // vendor is "honey", "Capital One Shopping", or "Rakuten"
24
22
  warn("You must disable the Honey extension to continue.");
25
23
  });
@@ -35,8 +33,8 @@ npm install coupon-shield
35
33
  ```js
36
34
  import { listen } from "coupon-shield";
37
35
 
38
- listen((warn, el, vendor) => {
39
- // Decide how you want to handle this. Native warn function allows you to tell the user to disable Honey.
36
+ listen((warn, vendor) => {
37
+ // Decide how you want to handle this. Native warn function allows you to tell the user to disable the extension.
40
38
  // vendor is "honey", "Capital One Shopping", or "Rakuten"
41
39
  warn("You must disable the Honey extension to continue.");
42
40
  });
@@ -45,15 +43,16 @@ listen((warn, el, vendor) => {
45
43
  ## Advanced Options
46
44
 
47
45
  ```js
48
- window.couponShield.listen((warn, el, vendor) => {
49
- // removeHoney defaults to true (element is auto-removed).
50
- // Set removeHoney to false if you want to keep the Honey element for some reason.
46
+ window.couponShield.listen((warn, vendor, el) => {
47
+ // removePageElement defaults to true (extension element loaded onto the page is auto-removed).
48
+ // Set removePageElement to false if you want to keep the extension element for some reason.
49
+ // el is only defined when removePageElement is false.
51
50
  // vendor is "honey", "Capital One Shopping", or "Rakuten"
52
- }, { removeHoney: false });
51
+ }, { removePageElement: false });
53
52
  ```
54
53
 
55
54
  ```js
56
- window.couponShield.listen((warn) => {
55
+ window.couponShield.listen((warn, vendor) => {
57
56
  // Stop observing if nothing is detected within 10 seconds.
58
57
  }, { unbindAfterSeconds: 10 });
59
58
  ```
package/dist/auto.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function() {
2
2
  // dist/bundle-tmp/version.js
3
- var VERSION = "0.3.11";
3
+ var VERSION = "0.3.12";
4
4
 
5
5
  // dist/bundle-tmp/core.js
6
6
  var __assign = function() {
@@ -205,7 +205,7 @@
205
205
  var zNearMax = (_a = options.zNearMax) !== null && _a !== void 0 ? _a : DEFAULT_Z_NEAR_MAX;
206
206
  var uuidGate = (_b = options.uuidGate) !== null && _b !== void 0 ? _b : true;
207
207
  var debug = (_c = options.debug) !== null && _c !== void 0 ? _c : false;
208
- var removeHoney = (_d = options.removeHoney) !== null && _d !== void 0 ? _d : true;
208
+ var removePageElement = (_d = options.removePageElement) !== null && _d !== void 0 ? _d : true;
209
209
  var unbindAfterSeconds = options.unbindAfterSeconds;
210
210
  var warn = function(message) {
211
211
  return showOverlay(message);
@@ -220,12 +220,12 @@
220
220
  clearTimeout(unbindTimer);
221
221
  unbindTimer = void 0;
222
222
  }
223
- if (removeHoney && el.parentNode)
223
+ if (removePageElement && el.parentNode)
224
224
  el.parentNode.removeChild(el);
225
- if (removeHoney) {
226
- onMatch(warn, void 0, vendor);
225
+ if (removePageElement) {
226
+ onMatch(warn, vendor, void 0);
227
227
  } else {
228
- onMatch(warn, el, vendor);
228
+ onMatch(warn, vendor, el);
229
229
  }
230
230
  };
231
231
  var mo = new MutationObserver(function(mutations) {
@@ -296,7 +296,7 @@
296
296
  window.couponShield = window.couponShield || {};
297
297
  window.couponShield.listen = listen;
298
298
  window.couponShield.version = version;
299
- window.couponShieldHandle = window.couponShield.listen(function(warn, _el, vendor) {
299
+ window.couponShieldHandle = window.couponShield.listen(function(warn, vendor) {
300
300
  var vendorName = vendor || "honey";
301
301
  var vendorLabel = vendorName.charAt(0).toUpperCase() + vendorName.slice(1);
302
302
  warn(buildAutoModalHtml(vendorLabel));
@@ -20,7 +20,7 @@ if (typeof window !== "undefined") {
20
20
  window.couponShield = window.couponShield || {};
21
21
  window.couponShield.listen = listen;
22
22
  window.couponShield.version = version;
23
- window.couponShieldHandle = window.couponShield.listen(function (warn, _el, vendor) {
23
+ window.couponShieldHandle = window.couponShield.listen(function (warn, vendor) {
24
24
  var vendorName = vendor || "honey";
25
25
  var vendorLabel = vendorName.charAt(0).toUpperCase() + vendorName.slice(1);
26
26
  warn(buildAutoModalHtml(vendorLabel));
@@ -202,7 +202,7 @@ export function startHoneyOverlayObserver(options) {
202
202
  var zNearMax = (_a = options.zNearMax) !== null && _a !== void 0 ? _a : DEFAULT_Z_NEAR_MAX;
203
203
  var uuidGate = (_b = options.uuidGate) !== null && _b !== void 0 ? _b : true;
204
204
  var debug = (_c = options.debug) !== null && _c !== void 0 ? _c : false;
205
- var removeHoney = (_d = options.removeHoney) !== null && _d !== void 0 ? _d : true;
205
+ var removePageElement = (_d = options.removePageElement) !== null && _d !== void 0 ? _d : true;
206
206
  var unbindAfterSeconds = options.unbindAfterSeconds;
207
207
  var warn = function (message) { return showOverlay(message); };
208
208
  var onMatch = (_e = options.onMatch) !== null && _e !== void 0 ? _e : (function () { });
@@ -214,13 +214,13 @@ export function startHoneyOverlayObserver(options) {
214
214
  clearTimeout(unbindTimer);
215
215
  unbindTimer = undefined;
216
216
  }
217
- if (removeHoney && el.parentNode)
217
+ if (removePageElement && el.parentNode)
218
218
  el.parentNode.removeChild(el);
219
- if (removeHoney) {
220
- onMatch(warn, undefined, vendor);
219
+ if (removePageElement) {
220
+ onMatch(warn, vendor, undefined);
221
221
  }
222
222
  else {
223
- onMatch(warn, el, vendor);
223
+ onMatch(warn, vendor, el);
224
224
  }
225
225
  };
226
226
  // Greedy, page-wide observer: Honey overlays can be inserted late, moved,
@@ -1,2 +1,2 @@
1
1
  // Auto-generated from package.json. Do not edit by hand.
2
- export var VERSION = "0.3.11";
2
+ export var VERSION = "0.3.12";
@@ -1,6 +1,6 @@
1
1
  (function() {
2
2
  // dist/bundle-tmp/version.js
3
- var VERSION = "0.3.11";
3
+ var VERSION = "0.3.12";
4
4
 
5
5
  // dist/bundle-tmp/core.js
6
6
  var __assign = function() {
@@ -205,7 +205,7 @@
205
205
  var zNearMax = (_a = options.zNearMax) !== null && _a !== void 0 ? _a : DEFAULT_Z_NEAR_MAX;
206
206
  var uuidGate = (_b = options.uuidGate) !== null && _b !== void 0 ? _b : true;
207
207
  var debug = (_c = options.debug) !== null && _c !== void 0 ? _c : false;
208
- var removeHoney = (_d = options.removeHoney) !== null && _d !== void 0 ? _d : true;
208
+ var removePageElement = (_d = options.removePageElement) !== null && _d !== void 0 ? _d : true;
209
209
  var unbindAfterSeconds = options.unbindAfterSeconds;
210
210
  var warn = function(message) {
211
211
  return showOverlay(message);
@@ -220,12 +220,12 @@
220
220
  clearTimeout(unbindTimer);
221
221
  unbindTimer = void 0;
222
222
  }
223
- if (removeHoney && el.parentNode)
223
+ if (removePageElement && el.parentNode)
224
224
  el.parentNode.removeChild(el);
225
- if (removeHoney) {
226
- onMatch(warn, void 0, vendor);
225
+ if (removePageElement) {
226
+ onMatch(warn, vendor, void 0);
227
227
  } else {
228
- onMatch(warn, el, vendor);
228
+ onMatch(warn, vendor, el);
229
229
  }
230
230
  };
231
231
  var mo = new MutationObserver(function(mutations) {
package/dist/esm/core.js CHANGED
@@ -202,7 +202,7 @@ export function startHoneyOverlayObserver(options) {
202
202
  var zNearMax = (_a = options.zNearMax) !== null && _a !== void 0 ? _a : DEFAULT_Z_NEAR_MAX;
203
203
  var uuidGate = (_b = options.uuidGate) !== null && _b !== void 0 ? _b : true;
204
204
  var debug = (_c = options.debug) !== null && _c !== void 0 ? _c : false;
205
- var removeHoney = (_d = options.removeHoney) !== null && _d !== void 0 ? _d : true;
205
+ var removePageElement = (_d = options.removePageElement) !== null && _d !== void 0 ? _d : true;
206
206
  var unbindAfterSeconds = options.unbindAfterSeconds;
207
207
  var warn = function (message) { return showOverlay(message); };
208
208
  var onMatch = (_e = options.onMatch) !== null && _e !== void 0 ? _e : (function () { });
@@ -214,13 +214,13 @@ export function startHoneyOverlayObserver(options) {
214
214
  clearTimeout(unbindTimer);
215
215
  unbindTimer = undefined;
216
216
  }
217
- if (removeHoney && el.parentNode)
217
+ if (removePageElement && el.parentNode)
218
218
  el.parentNode.removeChild(el);
219
- if (removeHoney) {
220
- onMatch(warn, undefined, vendor);
219
+ if (removePageElement) {
220
+ onMatch(warn, vendor, undefined);
221
221
  }
222
222
  else {
223
- onMatch(warn, el, vendor);
223
+ onMatch(warn, vendor, el);
224
224
  }
225
225
  };
226
226
  // Greedy, page-wide observer: Honey overlays can be inserted late, moved,
@@ -1,2 +1,2 @@
1
1
  // Auto-generated from package.json. Do not edit by hand.
2
- export var VERSION = "0.3.11";
2
+ export var VERSION = "0.3.12";
@@ -1,13 +1,13 @@
1
- export declare const version = "0.3.11";
1
+ export declare const version = "0.3.12";
2
2
  export type WarnCallback = (message: string) => () => void;
3
3
  export type DetectedVendor = "honey" | "Capital One Shopping" | "Rakuten";
4
- export type MatchCallback = (warn: WarnCallback, el?: HTMLDivElement, vendor?: DetectedVendor) => void;
4
+ export type MatchCallback = (warn: WarnCallback, vendor?: DetectedVendor, el?: HTMLDivElement) => void;
5
5
  export interface ObserverOptions {
6
6
  onMatch?: MatchCallback;
7
7
  uuidGate?: boolean;
8
8
  zNearMax?: number;
9
9
  debug?: boolean;
10
- removeHoney?: boolean;
10
+ removePageElement?: boolean;
11
11
  unbindAfterSeconds?: number;
12
12
  }
13
13
  export interface ObserverHandle {
@@ -1 +1 @@
1
- export declare const VERSION = "0.3.11";
1
+ export declare const VERSION = "0.3.12";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coupon-shield",
3
- "version": "0.3.11",
3
+ "version": "0.3.12",
4
4
  "description": "Detects Honey browser extension overlays for merchants.",
5
5
  "license": "MIT",
6
6
  "main": "dist/couponshield.js",