featurely-site-manager 1.1.20 → 1.1.22

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
@@ -35,6 +35,11 @@ interface FeatureFlag {
35
35
  weight: number;
36
36
  }[];
37
37
  defaultVariant?: string;
38
+ targetAttributes?: Array<{
39
+ attribute: string;
40
+ operator: "equals" | "not_equals" | "contains" | "greater_than" | "less_than";
41
+ value: string | number | boolean;
42
+ }>;
38
43
  }
39
44
  interface MaintenanceConfig {
40
45
  enabled: boolean;
@@ -52,17 +57,25 @@ interface MaintenanceConfig {
52
57
  interface AppVersion {
53
58
  version: string;
54
59
  title: string;
55
- releaseNotes: string;
60
+ releaseNotes?: string;
56
61
  downloadUrl?: string;
62
+ platformUrls?: Record<string, string>;
57
63
  releaseDate: string;
58
64
  isBeta?: boolean;
65
+ rolloutPercentage?: number;
59
66
  }
60
67
  interface VersionCheckResponse {
61
68
  updateAvailable: boolean;
62
69
  updateRequired: boolean;
63
70
  updateRecommended: boolean;
71
+ updateType?: "major" | "minor" | "patch" | "hash" | "unknown";
64
72
  latestVersion?: AppVersion;
65
73
  }
74
+ interface VersionUpdateRules {
75
+ major?: "required" | "available";
76
+ minor?: "required" | "available";
77
+ patch?: "required" | "recommended" | "available";
78
+ }
66
79
  interface SiteConfig {
67
80
  maintenance: MaintenanceConfig;
68
81
  messages: StatusMessage[];
@@ -73,6 +86,7 @@ interface SiteManagerConfig {
73
86
  apiKey: string;
74
87
  projectId: string;
75
88
  apiUrl?: string;
89
+ environment?: string;
76
90
  pollInterval?: number;
77
91
  userEmail?: string;
78
92
  bypassCheck?: () => boolean;
@@ -82,6 +96,8 @@ interface SiteManagerConfig {
82
96
  onMessageDismissed?: (messageId: string) => void;
83
97
  onFeatureFlagsUpdated?: (flags: FeatureFlag[]) => void;
84
98
  userId?: string;
99
+ customAttributes?: Record<string, string | number | boolean>;
100
+ bootstrapFlags?: Record<string, boolean>;
85
101
  enableAnalytics?: boolean;
86
102
  analyticsFlushInterval?: number;
87
103
  appVersion?: string;
@@ -89,12 +105,18 @@ interface SiteManagerConfig {
89
105
  versionCheckInterval?: number;
90
106
  onUpdateAvailable?: (versionInfo: VersionCheckResponse) => void;
91
107
  onUpdateRequired?: (versionInfo: VersionCheckResponse) => void;
108
+ platform?: string;
109
+ updateRules?: VersionUpdateRules;
92
110
  onError?: (error: Error) => void;
93
111
  debugMode?: boolean;
112
+ debugSecret?: string;
113
+ autoInjectBanners?: boolean;
114
+ autoCaptureClicks?: boolean;
94
115
  }
95
116
  declare class SiteManager {
96
117
  private config;
97
118
  private siteConfig;
119
+ private configETag;
98
120
  private pollIntervalId;
99
121
  private versionCheckIntervalId;
100
122
  private messageContainers;
@@ -122,20 +144,30 @@ declare class SiteManager {
122
144
  private testFeedback;
123
145
  private errorCount;
124
146
  private consoleIntercepted;
147
+ private visitorId;
148
+ private flagOverrides;
125
149
  private originalConsoleError;
126
150
  private originalConsoleWarn;
127
151
  constructor(config: SiteManagerConfig);
128
152
  init(): Promise<void>;
129
153
  destroy(): void;
130
- setUser(email: string, userId?: string): void;
131
- isFeatureEnabled(flagKey: string): boolean;
154
+ setUser(email: string, userId?: string, customAttributes?: Record<string, string | number | boolean>): void;
155
+ isFeatureEnabled(flagKey: string, defaultValue?: boolean): boolean;
132
156
  getFeatureVariant(flagKey: string): string | null;
133
157
  getAllFeatureFlags(): FeatureFlag[];
134
158
  getEnabledFeatures(): string[];
159
+ getActiveEnvironment(): {
160
+ id: string;
161
+ name: string;
162
+ slug: string;
163
+ } | null;
164
+ isErrorLoggingEnabled(): boolean;
165
+ overrideFlag(flagKey: string, value: boolean | null): void;
135
166
  isInMaintenanceMode(): boolean;
136
167
  getActiveMessages(): StatusMessage[];
137
168
  refresh(): Promise<void>;
138
169
  trackEvent(eventName: string, properties?: Record<string, string | number | boolean>): void;
170
+ track404(path?: string): void;
139
171
  private fetchConfig;
140
172
  private startPolling;
141
173
  private stopPolling;
@@ -149,19 +181,28 @@ declare class SiteManager {
149
181
  private setupDebugOverlay;
150
182
  private renderDebugOverlay;
151
183
  private handleTestAction;
184
+ private parseUtmParams;
185
+ private setupWebVitals;
186
+ private setupOutboundLinkTracking;
187
+ private setupAutoClickCapture;
152
188
  private setupPageTracking;
153
189
  private trackPageView;
154
190
  private trackPageExit;
155
191
  private onNavigate;
156
192
  private generateSessionId;
157
193
  checkVersion(currentVersion?: string): Promise<VersionCheckResponse | null>;
194
+ forceUpdateWeb(): Promise<void>;
158
195
  getLastVersionCheck(): VersionCheckResponse | null;
159
196
  private startVersionChecking;
160
197
  private stopVersionChecking;
198
+ private resolveEnvironment;
199
+ private hostnameMatchesEnv;
200
+ private matchHostnamePattern;
161
201
  private evaluateFeatureFlag;
162
202
  private getUserBucket;
163
203
  private simpleHash;
164
204
  private getAnonymousId;
205
+ private getOrCreateVisitorId;
165
206
  private checkMaintenanceMode;
166
207
  private enableMaintenanceMode;
167
208
  private disableMaintenanceMode;
@@ -180,4 +221,4 @@ declare class SiteManager {
180
221
  private injectStyles;
181
222
  }
182
223
 
183
- export { type AppVersion, type FeatureFlag, type MaintenanceConfig, type MessagePosition, type MessageStyle, type MessageType, type SiteConfig, SiteManager, type SiteManagerConfig, type StatusMessage, type VersionCheckResponse, SiteManager as default };
224
+ export { type AppVersion, type FeatureFlag, type MaintenanceConfig, type MessagePosition, type MessageStyle, type MessageType, type SiteConfig, SiteManager, type SiteManagerConfig, type StatusMessage, type VersionCheckResponse, type VersionUpdateRules, SiteManager as default };
package/dist/index.d.ts CHANGED
@@ -35,6 +35,11 @@ interface FeatureFlag {
35
35
  weight: number;
36
36
  }[];
37
37
  defaultVariant?: string;
38
+ targetAttributes?: Array<{
39
+ attribute: string;
40
+ operator: "equals" | "not_equals" | "contains" | "greater_than" | "less_than";
41
+ value: string | number | boolean;
42
+ }>;
38
43
  }
39
44
  interface MaintenanceConfig {
40
45
  enabled: boolean;
@@ -52,17 +57,25 @@ interface MaintenanceConfig {
52
57
  interface AppVersion {
53
58
  version: string;
54
59
  title: string;
55
- releaseNotes: string;
60
+ releaseNotes?: string;
56
61
  downloadUrl?: string;
62
+ platformUrls?: Record<string, string>;
57
63
  releaseDate: string;
58
64
  isBeta?: boolean;
65
+ rolloutPercentage?: number;
59
66
  }
60
67
  interface VersionCheckResponse {
61
68
  updateAvailable: boolean;
62
69
  updateRequired: boolean;
63
70
  updateRecommended: boolean;
71
+ updateType?: "major" | "minor" | "patch" | "hash" | "unknown";
64
72
  latestVersion?: AppVersion;
65
73
  }
74
+ interface VersionUpdateRules {
75
+ major?: "required" | "available";
76
+ minor?: "required" | "available";
77
+ patch?: "required" | "recommended" | "available";
78
+ }
66
79
  interface SiteConfig {
67
80
  maintenance: MaintenanceConfig;
68
81
  messages: StatusMessage[];
@@ -73,6 +86,7 @@ interface SiteManagerConfig {
73
86
  apiKey: string;
74
87
  projectId: string;
75
88
  apiUrl?: string;
89
+ environment?: string;
76
90
  pollInterval?: number;
77
91
  userEmail?: string;
78
92
  bypassCheck?: () => boolean;
@@ -82,6 +96,8 @@ interface SiteManagerConfig {
82
96
  onMessageDismissed?: (messageId: string) => void;
83
97
  onFeatureFlagsUpdated?: (flags: FeatureFlag[]) => void;
84
98
  userId?: string;
99
+ customAttributes?: Record<string, string | number | boolean>;
100
+ bootstrapFlags?: Record<string, boolean>;
85
101
  enableAnalytics?: boolean;
86
102
  analyticsFlushInterval?: number;
87
103
  appVersion?: string;
@@ -89,12 +105,18 @@ interface SiteManagerConfig {
89
105
  versionCheckInterval?: number;
90
106
  onUpdateAvailable?: (versionInfo: VersionCheckResponse) => void;
91
107
  onUpdateRequired?: (versionInfo: VersionCheckResponse) => void;
108
+ platform?: string;
109
+ updateRules?: VersionUpdateRules;
92
110
  onError?: (error: Error) => void;
93
111
  debugMode?: boolean;
112
+ debugSecret?: string;
113
+ autoInjectBanners?: boolean;
114
+ autoCaptureClicks?: boolean;
94
115
  }
95
116
  declare class SiteManager {
96
117
  private config;
97
118
  private siteConfig;
119
+ private configETag;
98
120
  private pollIntervalId;
99
121
  private versionCheckIntervalId;
100
122
  private messageContainers;
@@ -122,20 +144,30 @@ declare class SiteManager {
122
144
  private testFeedback;
123
145
  private errorCount;
124
146
  private consoleIntercepted;
147
+ private visitorId;
148
+ private flagOverrides;
125
149
  private originalConsoleError;
126
150
  private originalConsoleWarn;
127
151
  constructor(config: SiteManagerConfig);
128
152
  init(): Promise<void>;
129
153
  destroy(): void;
130
- setUser(email: string, userId?: string): void;
131
- isFeatureEnabled(flagKey: string): boolean;
154
+ setUser(email: string, userId?: string, customAttributes?: Record<string, string | number | boolean>): void;
155
+ isFeatureEnabled(flagKey: string, defaultValue?: boolean): boolean;
132
156
  getFeatureVariant(flagKey: string): string | null;
133
157
  getAllFeatureFlags(): FeatureFlag[];
134
158
  getEnabledFeatures(): string[];
159
+ getActiveEnvironment(): {
160
+ id: string;
161
+ name: string;
162
+ slug: string;
163
+ } | null;
164
+ isErrorLoggingEnabled(): boolean;
165
+ overrideFlag(flagKey: string, value: boolean | null): void;
135
166
  isInMaintenanceMode(): boolean;
136
167
  getActiveMessages(): StatusMessage[];
137
168
  refresh(): Promise<void>;
138
169
  trackEvent(eventName: string, properties?: Record<string, string | number | boolean>): void;
170
+ track404(path?: string): void;
139
171
  private fetchConfig;
140
172
  private startPolling;
141
173
  private stopPolling;
@@ -149,19 +181,28 @@ declare class SiteManager {
149
181
  private setupDebugOverlay;
150
182
  private renderDebugOverlay;
151
183
  private handleTestAction;
184
+ private parseUtmParams;
185
+ private setupWebVitals;
186
+ private setupOutboundLinkTracking;
187
+ private setupAutoClickCapture;
152
188
  private setupPageTracking;
153
189
  private trackPageView;
154
190
  private trackPageExit;
155
191
  private onNavigate;
156
192
  private generateSessionId;
157
193
  checkVersion(currentVersion?: string): Promise<VersionCheckResponse | null>;
194
+ forceUpdateWeb(): Promise<void>;
158
195
  getLastVersionCheck(): VersionCheckResponse | null;
159
196
  private startVersionChecking;
160
197
  private stopVersionChecking;
198
+ private resolveEnvironment;
199
+ private hostnameMatchesEnv;
200
+ private matchHostnamePattern;
161
201
  private evaluateFeatureFlag;
162
202
  private getUserBucket;
163
203
  private simpleHash;
164
204
  private getAnonymousId;
205
+ private getOrCreateVisitorId;
165
206
  private checkMaintenanceMode;
166
207
  private enableMaintenanceMode;
167
208
  private disableMaintenanceMode;
@@ -180,4 +221,4 @@ declare class SiteManager {
180
221
  private injectStyles;
181
222
  }
182
223
 
183
- export { type AppVersion, type FeatureFlag, type MaintenanceConfig, type MessagePosition, type MessageStyle, type MessageType, type SiteConfig, SiteManager, type SiteManagerConfig, type StatusMessage, type VersionCheckResponse, SiteManager as default };
224
+ export { type AppVersion, type FeatureFlag, type MaintenanceConfig, type MessagePosition, type MessageStyle, type MessageType, type SiteConfig, SiteManager, type SiteManagerConfig, type StatusMessage, type VersionCheckResponse, type VersionUpdateRules, SiteManager as default };