browser-extension-manager 1.0.7 → 1.0.8

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.
@@ -1,7 +1,3 @@
1
- // Libraries
2
- const ext = require('./extension.js');
3
- const storage = ext.storage;
4
-
5
1
  // Suppported affiliates
6
2
  const map = [
7
3
  // Amazon
@@ -113,7 +109,11 @@ Affiliatizer.get = function () {
113
109
  return map;
114
110
  };
115
111
 
116
- Affiliatizer.initialize = async function (parent) {
112
+ Affiliatizer.initialize = async function (Manager) {
113
+ // Shortcuts
114
+ const { extension, logger } = Manager;
115
+ const { storage } = extension;
116
+
117
117
  // Parse the URL
118
118
  const url = new URL(window.location.href);
119
119
  const query = url.searchParams;
@@ -124,23 +124,23 @@ Affiliatizer.initialize = async function (parent) {
124
124
  // Check if the URL has the affiliatizerStatus parameter
125
125
  if (qsStatus === 'reset') {
126
126
  // Log
127
- parent.log('Resetting affiliatizer data...');
127
+ logger.log('Resetting affiliatizer data...');
128
128
 
129
129
  // Reset the data
130
130
  await storage.set({ affiliatizer: null });
131
131
  query.delete('affiliatizerStatus');
132
132
 
133
133
  // Log
134
- parent.log('Reset!');
134
+ logger.log('Reset!');
135
135
  } else if (qsStatus === 'block') {
136
136
  // Log
137
- parent.log('Affiliatizer is blocked.');
137
+ logger.log('Affiliatizer is blocked.');
138
138
 
139
139
  // Set affiliatizer to 'block' in storage
140
140
  await storage.set({ affiliatizer: 'block' });
141
141
  } else if (qsStatus === 'allow') {
142
142
  // Log
143
- parent.log('Affiliatizer is allowed.');
143
+ logger.log('Affiliatizer is allowed.');
144
144
 
145
145
  // Set affiliatizer to 'allow' in storage
146
146
  await storage.set({ affiliatizer: 'allow' });
@@ -152,7 +152,7 @@ Affiliatizer.initialize = async function (parent) {
152
152
 
153
153
  // Check if it's blocked
154
154
  if (status === 'block') {
155
- parent.log('Affiliatizer is blocked.');
155
+ logger.log('Affiliatizer is blocked.');
156
156
  return;
157
157
  }
158
158
 
@@ -162,7 +162,7 @@ Affiliatizer.initialize = async function (parent) {
162
162
  const id = item.id;
163
163
 
164
164
  // Log
165
- // parent.log('Checking for', id, item.match, 'in', url.hostname, '...');
165
+ // logger.log('Checking for', id, item.match, 'in', url.hostname, '...');
166
166
 
167
167
  // Check if the item matches
168
168
  if (!item.match.test(url.hostname)) {
@@ -172,7 +172,7 @@ Affiliatizer.initialize = async function (parent) {
172
172
  // Process
173
173
  storage.get((data) => {
174
174
  // Log
175
- parent.log('Matched', data);
175
+ logger.log('Matched', data);
176
176
 
177
177
  // Set the default data
178
178
  const now = new Date();
@@ -205,7 +205,7 @@ Affiliatizer.initialize = async function (parent) {
205
205
  }
206
206
 
207
207
  // Log
208
- parent.log('Redirecting...', newURL.toString());
208
+ logger.log('Redirecting...', newURL.toString());
209
209
 
210
210
  // Save to storage
211
211
  const newTimestamp = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-extension-manager",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Browser Extension Manager dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {