package com.freshworks.freshdesk.reactnative import com.freshworks.sdk.freshdesk.data.content.ContentConfiguration import com.google.gson.Gson internal object FreshdeskJsonUtils { private val gson = Gson() // trackEvent/setUserProperties/setTicketProperties used to parse a JSON string // here (parsePropertiesMap); they now receive a ReadableMap directly from // codegen and call `.toHashMap()` themselves — see FreshdeskModule.kt. The // JSON-string path stays only for setContentConfiguration below, whose native // SDK counterpart (ContentConfiguration) is a nested, strongly-typed class // rather than a flat property bag, so a ReadableMap -> ContentConfiguration // mapping is a separate, larger change than this one. fun parseContentConfiguration(json: String): ContentConfiguration { if (json.isBlank() || json == "{}") { return ContentConfiguration() } return gson.fromJson(json, ContentConfiguration::class.java) } fun toJson(value: Any): String = gson.toJson(value) }