CustomerCenterConfiguration
Configure the Customer Center screens, actions, support details, and appearance.
Purpose
CustomerCenterConfiguration controls the management and no-purchases screens shown by Superwall.instance.presentCustomerCenter(). Set the default on SuperwallOptions.customerCenter, or pass a configuration to a single presentation.
Signature
data class CustomerCenterConfiguration(
val managementScreen: Screen,
val noPurchasesScreen: Screen,
val support: Support = Support(),
val appearance: Appearance = Appearance(),
val showsAccountDetails: Boolean = true,
val warnsAboutDuplicateSubscriptions: Boolean = true
)CustomerCenterConfiguration.default creates the built-in configuration: the management screen has restore, change plan, refund, manage subscription with the built-in cancellation survey, and contact support; the no-purchases screen has restore. Purchase-specific actions appear when they apply. The contact support path is hidden until support.email is set.
Parameters
Prop
Type
Screens and paths
Each Screen has an optional title and subtitle plus an ordered list of paths:
data class Screen(
val title: String? = null,
val subtitle: String? = null,
val paths: List<Path>
)When a title is null, the screen uses its localized default title. A null subtitle uses the localized no-purchases subtitle or no subtitle on the management screen.
Each Path has a type, optional row title, optional survey, and an analytics ID:
data class Path(
val type: PathType,
val title: String? = null,
val survey: FeedbackSurvey? = null,
val id: String = type.defaultId
)Use the Path factory methods to create common paths:
import com.superwall.sdk.customercenter.CustomerCenterConfiguration.FeedbackSurvey
import com.superwall.sdk.customercenter.CustomerCenterConfiguration.Path
Path.restore()
Path.manageSubscription(survey = FeedbackSurvey.cancellation)
Path.refund(windowMillis = 7L * 24 * 60 * 60 * 1000)
Path.changePlan()
Path.contactSupport()
Path.url(url = "https://example.com/help", title = "Help")
Path.custom(identifier = "billing_settings", title = "Billing settings")restore()starts a purchase restore.manageSubscription()opens the available subscription management flow. AwebManagementUrlcan supply the web management destination for web subscriptions.refund(windowMillis)opens Google Play's order history;windowMillisoptionally limits eligible purchases by age.changePlan(productIds)opens the subscription's page in Google Play.productIdsis accepted but has no effect on Android.contactSupport()is shown whensupport.emailis set.url(url, title, openMethod)opens a URL.titleis required;IN_APPis the default for HTTP and HTTPS links, andEXTERNALhands the URL to another app.custom(identifier, title)callsCustomerCenterDelegate.customerCenterDidSelectAction()with aCustomerCenterAction.Custom. Handle navigation or other behavior in your app.
id defaults to the path type's ID and is reported in Customer Center events as path_id. Supply a distinct ID when a screen contains multiple paths of the same type. URL path IDs omit query strings and fragments.
Surveys
FeedbackSurvey is an optional single-choice survey shown before a path runs:
data class FeedbackSurvey(
val id: String,
val title: String? = null,
val options: List<Option>
)FeedbackSurvey.cancellation is the built-in localized cancellation survey. It asks why the customer is cancelling and provides Option.tooExpensive, Option.dontUse, and Option.boughtByMistake. For custom surveys, provide an id, optional title, and a list of Option(id, title) values. Only manage-subscription paths have a localized default question; a custom survey with no title shows no question. Custom option titles are required for visible text; built-in option IDs use localized titles when their title is null.
Support and appearance
data class Support(
val email: String? = null,
val latestAppVersion: String? = null,
val warnsAboutUpdates: Boolean = true,
val webManagementUrl: String? = null
)
data class Appearance(
val accent: ColorPair? = null
)
data class ColorPair(val light: String, val dark: String)- Set
support.emailto show the contact support path. - Set
support.latestAppVersionto show an update banner when it is newer than the installed version.warnsAboutUpdatescontrols that banner. - Set
support.webManagementUrlto override the web subscription management destination. appearance.accenttints buttons and links. Providelightanddarkcolors as#RRGGBBor#RRGGBBAAstrings;nulluses the theme accent.
Related
How is this guide?