UNPKG

@qonversion/capacitor-plugin

Version:

Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and co

78 lines 2.73 kB
import { NoCodesConfig } from './NoCodesConfig'; export class NoCodesConfigBuilder { constructor(projectKey) { this.noCodesListener = undefined; this.purchaseDelegate = undefined; this.proxyUrl = undefined; this.locale = undefined; this.theme = undefined; this.projectKey = projectKey; } /** * Provide a listener to be notified about NoCodes events. * * Make sure you provide this listener for being up-to-date with the NoCodes events. * Else you can lose some important updates. Also, please, consider that this listener * should live for the whole lifetime of the application. * * @param noCodesListener listener to be called when NoCodes events occur. * @return builder instance for chain calls. */ setNoCodesListener(noCodesListener) { this.noCodesListener = noCodesListener; return this; } /** * Provide a delegate for custom purchase and restore handling. * When this delegate is provided, it replaces the default Qonversion SDK purchase flow. * * @param purchaseDelegate delegate to handle purchase and restore operations. * @return builder instance for chain calls. */ setPurchaseDelegate(purchaseDelegate) { this.purchaseDelegate = purchaseDelegate; return this; } /** * Set proxy URL for NoCodes SDK. * * @param proxyUrl proxy URL to use for API requests. * @return builder instance for chain calls. */ setProxyURL(proxyUrl) { this.proxyUrl = proxyUrl; return this; } /** * Set the locale for No-Code screens. * Use this to override the device locale for the No-Codes SDK. * * @param locale the locale to use (e.g. "en", "de", "fr"). * @return builder instance for chain calls. */ setLocale(locale) { this.locale = locale; return this; } /** * Set the theme mode for No-Code screens. * Controls how screens adapt to light/dark themes. * * @param theme the desired theme mode. Use AUTO to follow device settings, * LIGHT to force light theme, or DARK to force dark theme. * @return builder instance for chain calls. */ setTheme(theme) { this.theme = theme; return this; } /** * Generate {@link NoCodesConfig} instance with all the provided configurations. * * @return the complete {@link NoCodesConfig} instance. */ build() { return new NoCodesConfig(this.projectKey, this.noCodesListener, this.purchaseDelegate, this.proxyUrl, this.locale, this.theme); } } //# sourceMappingURL=NoCodesConfigBuilder.js.map