react-native-inapp-inspector 1.1.11 → 1.1.12

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatDateTimeToAnalytics = exports.isAllValuesEmpty = exports.getLocalizedFilePathWithSlash = exports.getLocalizedFilePath = exports.formatDisplayUrl = exports.getDiff = exports.flattenObject = exports.getNavigationInfo = exports.escapeRegex = exports.deduplicateLogs = exports.getFetchCommand = exports.getCurlCommand = exports.getBaseUrl = exports.getPath = exports.copyToClipboard = exports.getSize = exports.getDurationColor = exports.getStatusColor = exports.formatDateTime = exports.getDomainColor = void 0;
3
+ exports.getAppName = exports.getBundleIdentifier = exports.formatDateTimeToAnalytics = exports.isAllValuesEmpty = exports.getLocalizedFilePathWithSlash = exports.getLocalizedFilePath = exports.formatDisplayUrl = exports.getDiff = exports.flattenObject = exports.getNavigationInfo = exports.escapeRegex = exports.deduplicateLogs = exports.getFetchCommand = exports.getCurlCommand = exports.getBaseUrl = exports.getPath = exports.copyToClipboard = exports.getSize = exports.getDurationColor = exports.getStatusColor = exports.formatDateTime = exports.getDomainColor = void 0;
4
4
  const react_native_1 = require("react-native");
5
5
  // Stylesheet
6
6
  const AppColors_1 = require("../styles/AppColors");
@@ -239,3 +239,91 @@ const formatDateTimeToAnalytics = (ts) => {
239
239
  });
240
240
  };
241
241
  exports.formatDateTimeToAnalytics = formatDateTimeToAnalytics;
242
+ const getBundleIdentifier = () => {
243
+ const RNDeviceInfo = react_native_1.NativeModules.RNDeviceInfo;
244
+ if (RNDeviceInfo && typeof RNDeviceInfo.bundleId === 'string') {
245
+ return RNDeviceInfo.bundleId;
246
+ }
247
+ if (RNDeviceInfo && typeof RNDeviceInfo.getBundleId === 'function') {
248
+ try {
249
+ const res = RNDeviceInfo.getBundleId();
250
+ if (typeof res === 'string')
251
+ return res;
252
+ }
253
+ catch (e) { }
254
+ }
255
+ const ExponentConstants = react_native_1.NativeModules.ExponentConstants;
256
+ if (ExponentConstants && ExponentConstants.manifest) {
257
+ const manifest = ExponentConstants.manifest;
258
+ if (manifest.ios && manifest.ios.bundleIdentifier) {
259
+ return manifest.ios.bundleIdentifier;
260
+ }
261
+ if (manifest.android && manifest.android.package) {
262
+ return manifest.android.package;
263
+ }
264
+ }
265
+ const ExpoApplication = react_native_1.NativeModules.ExpoApplication;
266
+ if (ExpoApplication && typeof ExpoApplication.applicationId === 'string') {
267
+ return ExpoApplication.applicationId;
268
+ }
269
+ const SourceCode = react_native_1.NativeModules.SourceCode;
270
+ if (SourceCode && typeof SourceCode.scriptURL === 'string') {
271
+ const url = SourceCode.scriptURL;
272
+ if (url.includes('assets/')) {
273
+ try {
274
+ const match = url.match(/assets\/([^/?#]+)/);
275
+ if (match && match[1]) {
276
+ return match[1];
277
+ }
278
+ }
279
+ catch (e) { }
280
+ }
281
+ }
282
+ return 'org.reactjs.native.example';
283
+ };
284
+ exports.getBundleIdentifier = getBundleIdentifier;
285
+ const getAppName = () => {
286
+ // Try iOS via PlatformConstants
287
+ const constants = react_native_1.NativeModules.PlatformConstants;
288
+ if (constants && typeof constants.interfaceIdiom === 'string') {
289
+ // On iOS, try to get display name from the main bundle
290
+ const SettingsManager = react_native_1.NativeModules.SettingsManager;
291
+ if (SettingsManager && SettingsManager.settings) {
292
+ const appName = SettingsManager.settings.AppleLocale
293
+ ? undefined
294
+ : undefined;
295
+ // Fallback: try to parse from SourceCode
296
+ }
297
+ }
298
+ // Try react-native-device-info
299
+ const RNDeviceInfo = react_native_1.NativeModules.RNDeviceInfo;
300
+ if (RNDeviceInfo && typeof RNDeviceInfo.appName === 'string') {
301
+ return RNDeviceInfo.appName;
302
+ }
303
+ // Try Expo
304
+ const ExpoApplication = react_native_1.NativeModules.ExpoApplication;
305
+ if (ExpoApplication && typeof ExpoApplication.applicationName === 'string') {
306
+ return ExpoApplication.applicationName;
307
+ }
308
+ const ExponentConstants = react_native_1.NativeModules.ExponentConstants;
309
+ if (ExponentConstants && ExponentConstants.manifest) {
310
+ const manifest = ExponentConstants.manifest;
311
+ if (manifest.name)
312
+ return manifest.name;
313
+ }
314
+ // Android: try to get from AndroidInfoModule
315
+ const AppInfo = react_native_1.NativeModules.AppInfo;
316
+ if (AppInfo && typeof AppInfo.appName === 'string') {
317
+ return AppInfo.appName;
318
+ }
319
+ // Fallback: derive from bundle ID (last segment, cleaned up)
320
+ const bundleId = (0, exports.getBundleIdentifier)();
321
+ if (bundleId && bundleId !== 'org.reactjs.native.example') {
322
+ const parts = bundleId.split('.');
323
+ const last = parts[parts.length - 1];
324
+ // Capitalize first letter
325
+ return last ? last.charAt(0).toUpperCase() + last.slice(1) : 'App';
326
+ }
327
+ return 'App';
328
+ };
329
+ exports.getAppName = getAppName;