@envive-ai/react-hooks 0.3.19-alpha-marlo-6 → 0.3.19-alpha-marlo-7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envive-ai/react-hooks",
3
- "version": "0.3.19-alpha-marlo-6",
3
+ "version": "0.3.19-alpha-marlo-7",
4
4
  "description": "React hooks for connecting to Envive AI services.",
5
5
  "keywords": [
6
6
  "react",
@@ -88,11 +88,11 @@ export class AmplitudeService {
88
88
  const gatesProps =
89
89
  featureGates.length > 0
90
90
  ? featureGates.reduce<Record<string, boolean>>((acc, [name, value]) => {
91
- if (name && value != null) {
92
- return { ...acc, [`feature_gate.${name}`]: value };
93
- }
94
- return acc;
95
- }, {})
91
+ if (name && value != null) {
92
+ return { ...acc, [`feature_gate.${name}`]: value };
93
+ }
94
+ return acc;
95
+ }, {})
96
96
  : {};
97
97
  const experimentProps = {}; // No direct equivalent for experiments in EnviveConfig yet
98
98
 
@@ -111,14 +111,14 @@ export class AmplitudeService {
111
111
 
112
112
  const orgLevelAmplitudeTrackingProps = AmplitudeService.isV3EnviveEvent(eventName)
113
113
  ? {
114
- ...this.config.featureFlagService.getFullFlagValues(),
115
- ...experimentProps,
116
- ...environmentProps,
117
- }
114
+ ...this.config.featureFlagService.getFullFlagValues(),
115
+ ...experimentProps,
116
+ ...environmentProps,
117
+ }
118
118
  : {
119
- ...gatesProps,
120
- ...experimentProps,
121
- };
119
+ ...gatesProps,
120
+ ...experimentProps,
121
+ };
122
122
  return {
123
123
  ...orgLevelAmplitudeTrackingProps,
124
124
  ...this.supplementalDefaultProps,
@@ -220,7 +220,10 @@ export class AmplitudeService {
220
220
  }
221
221
 
222
222
  private static isValidAmplitudeApiKey(apiKey: string): boolean {
223
- return /^[0-9a-f]{32}$/i.test(apiKey);
223
+ if (apiKey === 'mock-amplitude-key') {
224
+ return false;
225
+ }
226
+ return true;
224
227
  }
225
228
 
226
229
  private initialize(): void {
@@ -240,9 +243,9 @@ export class AmplitudeService {
240
243
 
241
244
  if (!AmplitudeService.isValidAmplitudeApiKey(this.config.amplitudeApiKey)) {
242
245
  this._isMockMode = true;
243
- // eslint-disable-next-line no-console
244
- console.log(
245
- '[AmplitudeService] Mock API key detected — running in mock mode, no events will be sent to Amplitude.',
246
+ logger.logWarn(
247
+ 'Dummy API key detected — running in mock mode, no events will be sent to Amplitude.',
248
+ this.config.amplitudeApiKey,
246
249
  );
247
250
  return;
248
251
  }
@@ -317,8 +320,8 @@ export class AmplitudeService {
317
320
  const messageMetadata = eventProps?.message_metadata ?? {};
318
321
  const triggerLocation =
319
322
  messageMetadata !== null &&
320
- typeof messageMetadata === 'object' &&
321
- 'trigger_location' in messageMetadata
323
+ typeof messageMetadata === 'object' &&
324
+ 'trigger_location' in messageMetadata
322
325
  ? messageMetadata.trigger_location
323
326
  : undefined;
324
327