react-native-my-survey-sdk 2.2.26 → 2.2.28

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": "react-native-my-survey-sdk",
3
- "version": "2.2.26",
3
+ "version": "2.2.28",
4
4
  "description": "Xebo survey collection SDK for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -8,7 +8,6 @@ import {
8
8
  XeboEnvironment,
9
9
  XeboUserData,
10
10
  XeboQualityFlags,
11
- XeboDeviceInfo,
12
11
  XeboGeolocation,
13
12
  } from '../models/XeboModels';
14
13
  import {
@@ -24,25 +23,33 @@ export function resolveZoneAndEnv(zone: string, explicitEnv?: XeboEnvironment):
24
23
  if (zone.startsWith('uat-')) {
25
24
  return { resolvedZone: zone.slice(4), environment: 'uat' };
26
25
  }
26
+ if (zone === 'preprod' || zone.startsWith('preprod-')) {
27
+ const resolvedZone = zone.startsWith('preprod-') ? zone.slice(8) : 'preprod';
28
+ return { resolvedZone, environment: 'preprod' };
29
+ }
27
30
  return { resolvedZone: zone, environment: explicitEnv ?? 'production' };
28
31
  }
29
32
 
30
33
  export function buildBaseURL(resolvedZone: string, environment: XeboEnvironment): string {
31
- return environment === 'uat'
32
- ? `https://uat-${resolvedZone}-api.xebo.ai`
33
- : `https://${resolvedZone}-api.xebo.ai`;
34
+ if (environment === 'uat') return `https://uat-${resolvedZone}-api.xebo.ai`;
35
+ if (environment === 'preprod') return resolvedZone === 'preprod'
36
+ ? 'https://preprod-api.xebo.ai'
37
+ : `https://preprod-${resolvedZone}-api.xebo.ai`;
38
+ return `https://${resolvedZone}-api.xebo.ai`;
34
39
  }
35
40
 
36
41
  export function buildFeedbackBaseURL(resolvedZone: string, environment: XeboEnvironment): string {
37
- return environment === 'uat'
38
- ? `https://uat-${resolvedZone}-feedback-api.xebo.ai`
39
- : `https://${resolvedZone}-feedback-api.xebo.ai`;
42
+ if (environment === 'uat') return `https://uat-${resolvedZone}-feedback-api.xebo.ai`;
43
+ if (environment === 'preprod') return resolvedZone === 'preprod'
44
+ ? 'https://preprod-feedback-api.xebo.ai'
45
+ : `https://preprod-${resolvedZone}-feedback-api.xebo.ai`;
46
+ return `https://${resolvedZone}-feedback-api.xebo.ai`;
40
47
  }
41
48
 
42
49
  export function buildVerifyURL(environment: XeboEnvironment): string {
43
- return environment === 'uat'
44
- ? 'https://uat-api.xebo.ai/api/v1/api-key/verify'
45
- : 'https://api.xebo.ai/api/v1/api-key/verify';
50
+ if (environment === 'uat') return 'https://uat-api.xebo.ai/api/v1/api-key/verify';
51
+ if (environment === 'preprod') return 'https://preprod-api.xebo.ai/api/v1/api-key/verify';
52
+ return 'https://api.xebo.ai/api/v1/api-key/verify';
46
53
  }
47
54
 
48
55
  // ─── Step 0: API key verification → bearer token ─────────────────────────────
@@ -52,14 +59,14 @@ export async function verifyApiKey(
52
59
  zone: string,
53
60
  apiKey: string,
54
61
  ): Promise<string> {
62
+ const url = `${verifyURL}?zone=${encodeURIComponent(zone)}`;
55
63
  console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
56
64
  console.log('[Xebo Step 0] Verifying API key');
57
- console.log('URL:', verifyURL);
65
+ console.log('URL:', url);
58
66
 
59
- const res = await fetch(verifyURL, {
60
- method: 'POST',
61
- headers: { 'Content-Type': 'application/json' },
62
- body: JSON.stringify({ zone, apiKey }),
67
+ const res = await fetch(url, {
68
+ method: 'GET',
69
+ headers: { 'x-api-key': apiKey },
63
70
  });
64
71
 
65
72
  const json = await res.json();
@@ -73,9 +80,9 @@ export async function verifyApiKey(
73
80
  }
74
81
 
75
82
  const token: string | undefined =
83
+ json?.access_token ??
76
84
  json?.token ??
77
85
  json?.data?.token ??
78
- json?.access_token ??
79
86
  json?.bearerToken ??
80
87
  json?.data?.access_token;
81
88
 
@@ -389,7 +396,6 @@ export interface SubmitMeta {
389
396
  startTime?: string;
390
397
  endTime?: string;
391
398
  qualityFlags?: XeboQualityFlags;
392
- deviceInfo?: XeboDeviceInfo;
393
399
  geolocation?: XeboGeolocation;
394
400
  }
395
401
 
@@ -425,7 +431,6 @@ export async function submitResponse(
425
431
  const payload: Record<string, unknown> = {
426
432
  collector_id: collectorUUID,
427
433
  ...(meta?.qualityFlags && { qualityFlags: meta.qualityFlags }),
428
- ...(meta?.deviceInfo && { deviceInfo: meta.deviceInfo }),
429
434
  ...(meta?.geolocation && { geoLocation: meta.geolocation }),
430
435
  responses: [
431
436
  {
@@ -40,7 +40,7 @@ import {
40
40
  XeboQueuedResponse,
41
41
  XeboUserData,
42
42
  XeboQualityFlags,
43
- XeboDeviceInfo,
43
+
44
44
  XeboGeolocation,
45
45
  } from '../models/XeboModels';
46
46
  import {
@@ -286,14 +286,6 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
286
286
  };
287
287
  }
288
288
 
289
- private _buildDeviceInfo(): XeboDeviceInfo {
290
- return {
291
- type: 'mobile',
292
- os: Platform.OS,
293
- browser: 'app',
294
- };
295
- }
296
-
297
289
  private _buildGeolocation(): XeboGeolocation {
298
290
  return {
299
291
  type: 'point',
@@ -324,7 +316,6 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
324
316
  startTime: this.surveyStartTime,
325
317
  endTime,
326
318
  qualityFlags: this._buildQualityFlags(),
327
- deviceInfo: this._buildDeviceInfo(),
328
319
  geolocation: this._buildGeolocation(),
329
320
  },
330
321
  );
@@ -361,7 +352,6 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
361
352
  platform: Platform.OS,
362
353
  osVersion: this.osVersion,
363
354
  qualityFlags: this._buildQualityFlags(),
364
- deviceInfo: this._buildDeviceInfo(),
365
355
  geolocation: this._buildGeolocation(),
366
356
  };
367
357
 
@@ -395,7 +385,6 @@ class XeboSurveyManagerClass extends SimpleEventEmitter {
395
385
  startTime: queued.startTime,
396
386
  endTime: queued.endTime,
397
387
  qualityFlags: queued.qualityFlags,
398
- deviceInfo: queued.deviceInfo,
399
388
  geolocation: queued.geolocation,
400
389
  },
401
390
  );
@@ -1,6 +1,6 @@
1
1
  // ─── Enums ───────────────────────────────────────────────────────────────────
2
2
 
3
- export type XeboEnvironment = 'production' | 'uat';
3
+ export type XeboEnvironment = 'production' | 'uat' | 'preprod';
4
4
 
5
5
  export enum XeboQuestionType {
6
6
  singleChoice = 'singleChoice',
@@ -149,7 +149,6 @@ export interface XeboQueuedResponse {
149
149
  platform?: string;
150
150
  osVersion?: string;
151
151
  qualityFlags?: XeboQualityFlags;
152
- deviceInfo?: XeboDeviceInfo;
153
152
  geolocation?: XeboGeolocation;
154
153
  }
155
154