/* Metro module 8514; source: modules/user_profile/UserProfileAnalyticsContext.tsx; dependencies: [31, 33, 6771, 8515, 491, 2] */ import UseAnalyticsLocations from '../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as JsxRuntimeModule from '../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */ function _fun67474(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#67474, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:6, offset: 0x01c24aa6, size: 185 bytes, params: 8, frame: 18 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_5 = ReactModule.createContext(null); (FileImportTrackerModule).fileFinishedImporting('modules/user_profile/UserProfileAnalyticsContext.tsx'); exports.UserProfileAnalyticsProvider = UserProfileAnalyticsProvider; exports.useCreateUserProfileAnalyticsContext = useCreateUserProfileAnalyticsContext; exports.useUserProfileAnalyticsContext = useUserProfileAnalyticsContext; function UserProfileAnalyticsProvider({value, children, openedAt, fetchStartedAt, fetchEndedAt, isLoaded}) { // fn#67475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:261, offset: 0x01c24b5f, size: 230 bytes, params: 2, frame: 18 isLoaded = !(isLoaded === undefined) && isLoaded; const isLoaded2 = isLoaded; const analyticsLocations = (UseAnalyticsLocations)().analyticsLocations; const binding = isLoaded2; const env0_4 = binding.useRef(undefined); const object = {analyticsLocations: analyticsLocations, value: value}; const object3 = object; const env0_6 = binding.useRef(object); binding.useEffect(_fun67476); binding.useEffect(_fun67477, [isLoaded]); const Provider = object3.Provider; return ( {children} ); function _fun67476() { // fn#67476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:464, offset: 0x01c24c45, size: 21 bytes, params: 1, frame: 2 env0_6.current = env0_5; } function _fun67477() { // fn#67477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:497, offset: 0x01c24c5a, size: 309 bytes, params: 1, frame: 22 var r6; var analyticsLocations; var value5; var value6; var value7; var moduleValue; var trackUserProfileAction; var object; var value8; var moduleValue2; var maybeTrackUserProfileUiViewed; const Date = global.Date; let value = Date.now(); let current = env0_4.current; if (current == null && openedAt != null) { env0_4.current = value - openedAt; } if (isLoaded) { current = env0_6.current; analyticsLocations = current.analyticsLocations; value5 = current.value; value6 = environment.__proto__; value7 = undefined; moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */; trackUserProfileAction = moduleValue.trackUserProfileAction; object = {action: 'VIEW', analyticsLocations: analyticsLocations}; value8 = copyDataProperties(object, value5, 'VIEW'); Reflect.apply(trackUserProfileAction, moduleValue, [object]); moduleValue2 = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */; maybeTrackUserProfileUiViewed = moduleValue2.maybeTrackUserProfileUiViewed; object = {profileUi: 'USER_PROFILE'}; current = env0_4.current; object.timeToInteractiveMs = current; if (openedAt != null) { value -= openedAt; r6 = value; } else { r6 = value7; } object.timeToLoadMs = r6; r6 = fetchStartedAt != null && fetchEndedAt != null ? fetchEndedAt - fetchStartedAt : value7; object.timeToFetchMs = r6; object.viewStartedAt = openedAt; object.fetchStartedAt = fetchStartedAt; object.analyticsLocations = analyticsLocations; copyDataProperties(object, value5, value8); Reflect.apply(maybeTrackUserProfileUiViewed, moduleValue2, [object]); } } } function useCreateUserProfileAnalyticsContext({layout, userId, guildId, channelId, messageId, roleId, sourceSessionId, showGuildProfile}) { // fn#67478, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1002, offset: 0x01c24d8f, size: 200 bytes, params: 2, frame: 23 const channelId2 = channelId; const roleId2 = roleId; showGuildProfile = showGuildProfile === undefined || showGuildProfile; return channelId2.useMemo(_fun67479, [channelId2.useContext(roleId2)?.sessionId, layout, userId, guildId, channelId, messageId, roleId, sourceSessionId, showGuildProfile]); function _fun67479() { // fn#67479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1180, offset: 0x01c24e57, size: 131 bytes, params: 1, frame: 12 const object = {}; const value = environment.__proto__; object.sessionId = (require(491) /* metro dependency 491 */).v4(); object.sourceSessionId = sourceSessionId ?? sessionId; object.layout = layout; object.userId = userId; object.guildId = guildId; object.channelId = channelId; object.messageId = messageId; object.roleId = roleId; object.showGuildProfile = showGuildProfile; return object; } } function useUserProfileAnalyticsContext() { // fn#67480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1375, offset: 0x01c24eda, size: 212 bytes, params: 1, frame: 17 const binding = env0_3; const value2 = binding.useContext(env0_5); const analyticsLocations = (UseAnalyticsLocations)().analyticsLocations; const object = {context: value2}; object.trackUserProfileAction = binding.useCallback(_fun67481, [value2, analyticsLocations]); object.trackUserProfileEditAction = binding.useCallback(_fun67482, [value2, analyticsLocations]); object.trackUserProfileEditSaved = binding.useCallback(_fun67483, [value2, analyticsLocations]); object.trackUserProfileWishlistAction = binding.useCallback(_fun67484, [value2, analyticsLocations]); return object; function _fun67481(a0) { // fn#67481, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1488, offset: 0x01c24fae, size: 85 bytes, params: 2, frame: 14 var value2; var moduleValue; var trackUserProfileAction; var object; var analyticsLocationsBinding; if (env0_0 != null) { value2 = environment.__proto__; moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */; trackUserProfileAction = moduleValue.trackUserProfileAction; object = {}; analyticsLocationsBinding = analyticsLocations; object.analyticsLocations = analyticsLocationsBinding; copyDataProperties(object, env0_0, analyticsLocationsBinding); copyDataProperties(object, a0, analyticsLocationsBinding); Reflect.apply(trackUserProfileAction, moduleValue, [object]); } } function _fun67482(a0) { // fn#67482, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1617, offset: 0x01c25003, size: 85 bytes, params: 2, frame: 14 var value2; var moduleValue; var trackUserProfileEditAction; var object; var analyticsLocationsBinding; if (env0_0 != null) { value2 = environment.__proto__; moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */; trackUserProfileEditAction = moduleValue.trackUserProfileEditAction; object = {}; analyticsLocationsBinding = analyticsLocations; object.analyticsLocations = analyticsLocationsBinding; copyDataProperties(object, env0_0, analyticsLocationsBinding); copyDataProperties(object, a0, analyticsLocationsBinding); Reflect.apply(trackUserProfileEditAction, moduleValue, [object]); } } function _fun67483(a0) { // fn#67483, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1749, offset: 0x01c25058, size: 85 bytes, params: 2, frame: 14 var value2; var moduleValue; var trackUserProfileEditSaved; var object; var analyticsLocationsBinding; if (env0_0 != null) { value2 = environment.__proto__; moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */; trackUserProfileEditSaved = moduleValue.trackUserProfileEditSaved; object = {}; analyticsLocationsBinding = analyticsLocations; object.analyticsLocations = analyticsLocationsBinding; copyDataProperties(object, env0_0, analyticsLocationsBinding); copyDataProperties(object, a0, analyticsLocationsBinding); Reflect.apply(trackUserProfileEditSaved, moduleValue, [object]); } } function _fun67484(a0) { // fn#67484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8699:1885, offset: 0x01c250ad, size: 85 bytes, params: 2, frame: 14 var value2; var moduleValue; var trackUserProfileWishlistAction; var object; var analyticsLocationsBinding; if (env0_0 != null) { value2 = environment.__proto__; moduleValue = require(8515) /* metro dependency 8515: UserProfileAnalyticsUtils */; trackUserProfileWishlistAction = moduleValue.trackUserProfileWishlistAction; object = {}; analyticsLocationsBinding = analyticsLocations; object.analyticsLocations = analyticsLocationsBinding; copyDataProperties(object, env0_0, analyticsLocationsBinding); copyDataProperties(object, a0, analyticsLocationsBinding); Reflect.apply(trackUserProfileWishlistAction, moduleValue, [object]); } } } } global.__d(_fun67474, 8514, [31, 33, 6771, 8515, 491, 2]) /* metro module 8514, dependencies: [31, 33, 6771, 8515, 491, 2] */;