@echoteam/signoz-react 1.0.6 → 1.0.7-beta.1

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.esm.js CHANGED
@@ -15263,13 +15263,17 @@ function getConfigValue(key) {
15263
15263
  }
15264
15264
  // Fungsi untuk memvalidasi konfigurasi
15265
15265
  function validateConfig(config) {
15266
- const requiredFields = ['serviceName', 'serviceVersion', 'environment', 'serviceNamespace', 'url'];
15266
+ const requiredFields = ['serviceName', 'serviceVersion', 'environment', 'serviceNamespace', 'url', 'allowedOrigins'];
15267
15267
  const missingFields = [];
15268
15268
  for (const field of requiredFields) {
15269
15269
  if (!config[field]) {
15270
15270
  missingFields.push(field);
15271
15271
  }
15272
15272
  }
15273
+ // Khusus validasi allowedOrigins: pastikan array tidak kosong
15274
+ if (config.allowedOrigins && config.allowedOrigins.length === 0) {
15275
+ missingFields.push('allowedOrigins tidak boleh kosong demi keamanan CORS');
15276
+ }
15273
15277
  return {
15274
15278
  isValid: missingFields.length === 0,
15275
15279
  missingFields
@@ -15277,14 +15281,19 @@ function validateConfig(config) {
15277
15281
  }
15278
15282
  // Fungsi untuk mengkonversi string allowed origins ke array
15279
15283
  function parseAllowedOrigins(originsStr) {
15284
+ // Jika tidak ada origins yang diset, izinkan semua URL
15280
15285
  if (!originsStr)
15281
- return [/.+/g];
15286
+ return ['*'];
15282
15287
  return originsStr.split(',').map(origin => {
15283
15288
  origin = origin.trim();
15284
15289
  // Jika string dimulai dan diakhiri dengan '/', anggap sebagai RegExp
15285
15290
  if (origin.startsWith('/') && origin.endsWith('/')) {
15286
15291
  return new RegExp(origin.slice(1, -1));
15287
15292
  }
15293
+ // Jika origin adalah '*', itu berarti allow all
15294
+ if (origin === '*') {
15295
+ return '.*';
15296
+ }
15288
15297
  return origin;
15289
15298
  });
15290
15299
  }
@@ -15364,10 +15373,22 @@ function initializeSignOzTracing(config) {
15364
15373
  }),
15365
15374
  ],
15366
15375
  });
15367
- console.log('SignOz tracing berhasil diinisialisasi');
15376
+ console.log('SignOz: Konfigurasi tracing:', {
15377
+ serviceName: effectiveConfig.serviceName,
15378
+ environment: effectiveConfig.environment,
15379
+ allowedOrigins: effectiveConfig.allowedOrigins,
15380
+ traceSampleRate: effectiveConfig.traceSampleRate
15381
+ });
15382
+ console.log('SignOz: Tracing berhasil diinisialisasi');
15368
15383
  }
15369
- catch (error) {
15384
+ catch (e) {
15385
+ const error = e;
15370
15386
  console.error('SignOz: Gagal menginisialisasi tracing:', error);
15387
+ console.error('SignOz: Detail error:', {
15388
+ name: error.name,
15389
+ message: error.message,
15390
+ stack: error.stack
15391
+ });
15371
15392
  }
15372
15393
  }
15373
15394