featurely-site-manager 1.1.1 → 1.1.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/index.d.mts CHANGED
@@ -113,6 +113,8 @@ declare class SiteManager {
113
113
  getFeatureVariant(flagKey: string): string | null;
114
114
  getAllFeatureFlags(): FeatureFlag[];
115
115
  getEnabledFeatures(): string[];
116
+ isInMaintenanceMode(): boolean;
117
+ getActiveMessages(): StatusMessage[];
116
118
  refresh(): Promise<void>;
117
119
  trackEvent(eventName: string, properties?: Record<string, string | number | boolean>): void;
118
120
  private fetchConfig;
package/dist/index.d.ts CHANGED
@@ -113,6 +113,8 @@ declare class SiteManager {
113
113
  getFeatureVariant(flagKey: string): string | null;
114
114
  getAllFeatureFlags(): FeatureFlag[];
115
115
  getEnabledFeatures(): string[];
116
+ isInMaintenanceMode(): boolean;
117
+ getActiveMessages(): StatusMessage[];
116
118
  refresh(): Promise<void>;
117
119
  trackEvent(eventName: string, properties?: Record<string, string | number | boolean>): void;
118
120
  private fetchConfig;
package/dist/index.js CHANGED
@@ -35,24 +35,6 @@ __export(index_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(index_exports);
37
37
  var import_dompurify = __toESM(require("dompurify"));
38
- var import_featurely_error_tracker = require("featurely-error-tracker");
39
- var internalErrorTracker = (() => {
40
- try {
41
- const tracker = new import_featurely_error_tracker.ErrorTracker({
42
- apiKey: "ft_live_R4nAn9dDWxk6X3oMzB-tcQh0NrYvA04IhSfwPMUmyaU",
43
- apiUrl: "https://www.featurely.no",
44
- environment: "production",
45
- appVersion: "1.1.1",
46
- maxBreadcrumbs: 30,
47
- enabled: true
48
- });
49
- tracker.install();
50
- return tracker;
51
- } catch (e) {
52
- console.warn("Failed to initialize SDK error tracking:", e);
53
- return null;
54
- }
55
- })();
56
38
  var _SiteManager = class _SiteManager {
57
39
  constructor(config) {
58
40
  this.siteConfig = null;
@@ -226,6 +208,39 @@ var _SiteManager = class _SiteManager {
226
208
  }
227
209
  return this.siteConfig.featureFlags.filter((flag) => flag.enabled && this.evaluateFeatureFlag(flag)).map((flag) => flag.key);
228
210
  }
211
+ /**
212
+ * Check if the site is currently in maintenance mode (accounting for bypass)
213
+ */
214
+ isInMaintenanceMode() {
215
+ var _a;
216
+ if (!((_a = this.siteConfig) == null ? void 0 : _a.maintenance.enabled)) return false;
217
+ return !this.shouldBypassMaintenance();
218
+ }
219
+ /**
220
+ * Get all currently active status messages for the current page and time
221
+ */
222
+ getActiveMessages() {
223
+ if (!this.siteConfig) return [];
224
+ const currentTime = /* @__PURE__ */ new Date();
225
+ const currentPath = typeof window !== "undefined" ? window.location.pathname : "";
226
+ return this.siteConfig.messages.filter((message) => {
227
+ if (this.dismissedMessages.has(message.id)) return false;
228
+ if (message.startsAt && new Date(message.startsAt) > currentTime) return false;
229
+ if (message.expiresAt && new Date(message.expiresAt) < currentTime) return false;
230
+ if (message.targetPages && message.targetPages.length > 0) {
231
+ const matches = message.targetPages.some((pattern) => {
232
+ try {
233
+ const escaped = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
234
+ return new RegExp(escaped).test(currentPath);
235
+ } catch {
236
+ return false;
237
+ }
238
+ });
239
+ if (!matches) return false;
240
+ }
241
+ return true;
242
+ });
243
+ }
229
244
  /**
230
245
  * Manually refresh configuration
231
246
  */
package/dist/index.mjs CHANGED
@@ -1,23 +1,5 @@
1
1
  // src/index.ts
2
2
  import DOMPurify from "dompurify";
3
- import { ErrorTracker } from "featurely-error-tracker";
4
- var internalErrorTracker = (() => {
5
- try {
6
- const tracker = new ErrorTracker({
7
- apiKey: "ft_live_R4nAn9dDWxk6X3oMzB-tcQh0NrYvA04IhSfwPMUmyaU",
8
- apiUrl: "https://www.featurely.no",
9
- environment: "production",
10
- appVersion: "1.1.1",
11
- maxBreadcrumbs: 30,
12
- enabled: true
13
- });
14
- tracker.install();
15
- return tracker;
16
- } catch (e) {
17
- console.warn("Failed to initialize SDK error tracking:", e);
18
- return null;
19
- }
20
- })();
21
3
  var _SiteManager = class _SiteManager {
22
4
  constructor(config) {
23
5
  this.siteConfig = null;
@@ -191,6 +173,39 @@ var _SiteManager = class _SiteManager {
191
173
  }
192
174
  return this.siteConfig.featureFlags.filter((flag) => flag.enabled && this.evaluateFeatureFlag(flag)).map((flag) => flag.key);
193
175
  }
176
+ /**
177
+ * Check if the site is currently in maintenance mode (accounting for bypass)
178
+ */
179
+ isInMaintenanceMode() {
180
+ var _a;
181
+ if (!((_a = this.siteConfig) == null ? void 0 : _a.maintenance.enabled)) return false;
182
+ return !this.shouldBypassMaintenance();
183
+ }
184
+ /**
185
+ * Get all currently active status messages for the current page and time
186
+ */
187
+ getActiveMessages() {
188
+ if (!this.siteConfig) return [];
189
+ const currentTime = /* @__PURE__ */ new Date();
190
+ const currentPath = typeof window !== "undefined" ? window.location.pathname : "";
191
+ return this.siteConfig.messages.filter((message) => {
192
+ if (this.dismissedMessages.has(message.id)) return false;
193
+ if (message.startsAt && new Date(message.startsAt) > currentTime) return false;
194
+ if (message.expiresAt && new Date(message.expiresAt) < currentTime) return false;
195
+ if (message.targetPages && message.targetPages.length > 0) {
196
+ const matches = message.targetPages.some((pattern) => {
197
+ try {
198
+ const escaped = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
199
+ return new RegExp(escaped).test(currentPath);
200
+ } catch {
201
+ return false;
202
+ }
203
+ });
204
+ if (!matches) return false;
205
+ }
206
+ return true;
207
+ });
208
+ }
194
209
  /**
195
210
  * Manually refresh configuration
196
211
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "featurely-site-manager",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Complete site management SDK for maintenance mode, status messages, feature flags, version checking, and analytics",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -41,11 +41,11 @@
41
41
  "license": "MIT",
42
42
  "repository": {
43
43
  "type": "git",
44
- "url": "https://github.com/yourusername/featurely.git",
44
+ "url": "https://github.com/featurely/site-manager",
45
45
  "directory": "packages/featurely-site-manager"
46
46
  },
47
47
  "bugs": {
48
- "url": "https://github.com/yourusername/featurely/issues"
48
+ "url": "https://github.com/featurely/site-manager/issues"
49
49
  },
50
50
  "homepage": "https://featurely.no",
51
51
  "devDependencies": {
@@ -54,7 +54,6 @@
54
54
  "typescript": "^5.0.0"
55
55
  },
56
56
  "dependencies": {
57
- "dompurify": "^3.3.3",
58
- "featurely-error-tracker": "^1.0.7"
57
+ "dompurify": "^3.3.3"
59
58
  }
60
59
  }